Avoid unconditionally unwrapping the Result - UI Stack System (#11575)

# Objective

- Fixes #11572

## Solution

- Avoid unconditionally unwrapping the `Result` in the `ui_stack_system`
function.
This commit is contained in:
Chia-Hsiang Cheng 2024-01-29 10:38:41 +08:00 committed by GitHub
parent b0f5d4df58
commit fb124c35be
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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;
}
}
}