Skip to content

Commit

Permalink
Avoid unconditionally unwrapping the Result - UI Stack System (bevyen…
Browse files Browse the repository at this point in the history
…gine#11575)

# Objective

- Fixes bevyengine#11572

## Solution

- Avoid unconditionally unwrapping the `Result` in the `ui_stack_system`
function.
  • Loading branch information
garychia authored and tjamaan committed Feb 6, 2024
1 parent 2544bf5 commit d45c780
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions crates/bevy_ui/src/stack.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,9 @@ pub fn ui_stack_system(
fill_stack_recursively(&mut ui_stack.uinodes, &mut global_context);

for (i, entity) in ui_stack.uinodes.iter().enumerate() {
update_query
.get_mut(*entity)
.unwrap()
.bypass_change_detection()
.stack_index = i as u32;
if let Ok(mut node) = update_query.get_mut(*entity) {
node.bypass_change_detection().stack_index = i as u32;
}
}
}

Expand Down

0 comments on commit d45c780

Please sign in to comment.