Skip to content

Commit

Permalink
Bugfix: apply_despawn_set silently fails if the entity doesn't exist
Browse files Browse the repository at this point in the history
  • Loading branch information
necrashter committed Dec 7, 2023
1 parent a8a0c82 commit 0d200cb
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/util/despawn.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,9 @@ impl DespawnSet {

fn apply_despawn_set(mut commands: Commands, mut despawn: ResMut<DespawnSet>) {
for entity in despawn.0.drain() {
commands.entity(entity).despawn_recursive();
if let Some(entity) = commands.get_entity(entity) {
entity.despawn_recursive();
}
// Silently fail if the entity does not exist anymore.
}
}

0 comments on commit 0d200cb

Please sign in to comment.