From 1b86e0a1e7db9f5d9e47f1c5099027a880081d0e Mon Sep 17 00:00:00 2001 From: Jondolf Date: Sat, 24 Jun 2023 23:51:43 +0300 Subject: [PATCH] Remove `unwrap` from `update_aabb_intervals` --- src/plugins/broad_phase.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/plugins/broad_phase.rs b/src/plugins/broad_phase.rs index 9183862e..6925062f 100644 --- a/src/plugins/broad_phase.rs +++ b/src/plugins/broad_phase.rs @@ -43,7 +43,9 @@ struct AabbIntervals(Vec<(Entity, ColliderAabb)>); /// Updates [`AabbIntervals`] to keep them in sync with the [`ColliderAabb`]s. fn update_aabb_intervals(aabbs: Query<&ColliderAabb>, mut intervals: ResMut) { for (ent, aabb) in intervals.0.iter_mut() { - *aabb = *aabbs.get(*ent).unwrap(); + if let Ok(new_aabb) = aabbs.get(*ent) { + *aabb = *new_aabb; + } } }