Skip to content

Commit

Permalink
Layouts window: Don't crash on dangling layout keys
Browse files Browse the repository at this point in the history
  • Loading branch information
crumblingstatue committed Oct 15, 2024
1 parent 3059fbe commit 1ddba87
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/gui/windows/layouts_window.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,10 @@ impl super::Window for LayoutsWindow {
}
if !self.selected.is_null() {
ui.separator();
let layout = &mut app.meta_state.meta.layouts[self.selected];
let Some(layout) = app.meta_state.meta.layouts.get_mut(self.selected) else {
self.selected = LayoutKey::null();
return;
};
ui.horizontal(|ui| {
if self.edit_name {
if ui.text_edit_singleline(&mut layout.name).lost_focus() {
Expand Down

0 comments on commit 1ddba87

Please sign in to comment.