From 1ddba87a1f67a468620ea28f99f94779ca0da821 Mon Sep 17 00:00:00 2001 From: crumblingstatue Date: Tue, 15 Oct 2024 23:50:43 +0200 Subject: [PATCH] Layouts window: Don't crash on dangling layout keys --- src/gui/windows/layouts_window.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/gui/windows/layouts_window.rs b/src/gui/windows/layouts_window.rs index a524cbb..bf05382 100644 --- a/src/gui/windows/layouts_window.rs +++ b/src/gui/windows/layouts_window.rs @@ -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() {