Skip to content

Commit fb124c3

Browse files
authored
Avoid unconditionally unwrapping the Result - UI Stack System (#11575)
# Objective - Fixes #11572 ## Solution - Avoid unconditionally unwrapping the `Result` in the `ui_stack_system` function.
1 parent b0f5d4d commit fb124c3

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

crates/bevy_ui/src/stack.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -58,11 +58,9 @@ pub fn ui_stack_system(
5858
fill_stack_recursively(&mut ui_stack.uinodes, &mut global_context);
5959

6060
for (i, entity) in ui_stack.uinodes.iter().enumerate() {
61-
update_query
62-
.get_mut(*entity)
63-
.unwrap()
64-
.bypass_change_detection()
65-
.stack_index = i as u32;
61+
if let Ok(mut node) = update_query.get_mut(*entity) {
62+
node.bypass_change_detection().stack_index = i as u32;
63+
}
6664
}
6765
}
6866

0 commit comments

Comments
 (0)