Skip to content

Commit 7f4e031

Browse files
authored
Change panicking insert to try_insert for removal of disabled entities (#858)
# Objective Removing a disabled entity panics when the `IslandPlugin` is enabled, because of an `insert` on a non-existent entity. ## Solution Change the `insert` to `try_insert`.
1 parent ecda69b commit 7f4e031

File tree

1 file changed

+2
-2
lines changed
  • src/dynamics/solver/islands

1 file changed

+2
-2
lines changed

src/dynamics/solver/islands/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ impl Plugin for IslandPlugin {
9191
if rb.is_dynamic() || rb.is_kinematic() {
9292
commands
9393
.entity(trigger.entity)
94-
.insert(BodyIslandNode::default());
94+
.try_insert(BodyIslandNode::default());
9595
}
9696
},
9797
);
@@ -113,7 +113,7 @@ impl Plugin for IslandPlugin {
113113
if rb.is_dynamic() || rb.is_kinematic() {
114114
commands
115115
.entity(trigger.entity)
116-
.insert(BodyIslandNode::default());
116+
.try_insert(BodyIslandNode::default());
117117
}
118118
},
119119
);

0 commit comments

Comments
 (0)