Fix crash when removing a collider with no graph ID.

This commit is contained in:
Crozet Sébastien
2020-11-24 14:57:37 +01:00
parent af39ec54d3
commit dc63c28f56

View File

@@ -137,8 +137,9 @@ impl NarrowPhase {
let mut i = 0; let mut i = 0;
while let Some(collider) = colliders.removed_colliders.read_ith(&cursor, i) { while let Some(collider) = colliders.removed_colliders.read_ith(&cursor, i) {
let graph_idx = self.graph_indices.get(collider.handle).unwrap(); // NOTE: if the collider does not have any graph indices currently, there is nothing
// to remove in the narrow-phase for this collider.
if let Some(graph_idx) = self.graph_indices.get(collider.handle) {
let proximity_graph_id = prox_id_remap let proximity_graph_id = prox_id_remap
.get(&collider.handle) .get(&collider.handle)
.copied() .copied()
@@ -156,6 +157,7 @@ impl NarrowPhase {
&mut prox_id_remap, &mut prox_id_remap,
&mut contact_id_remap, &mut contact_id_remap,
); );
}
i += 1; i += 1;
} }