Skip to content

Commit

Permalink
Fix server crash on client disconnect due to incomplete entity removal
Browse files Browse the repository at this point in the history
  • Loading branch information
patowen authored and Ralith committed Sep 10, 2023
1 parent 27f0dab commit 1f5780b
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions server/src/sim.rs
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,9 @@ impl Sim {
pub fn destroy(&mut self, entity: Entity) {
let id = *self.world.get::<&EntityId>(entity).unwrap();
self.entity_ids.remove(&id);
if let Ok(position) = self.world.get::<&Position>(entity) {
self.graph_entities.remove(position.node, entity);
}
self.world.despawn(entity).unwrap();
self.despawns.push(id);
}
Expand Down

0 comments on commit 1f5780b

Please sign in to comment.