From 5dd4773205fa63bc669685fbbdbeea4a49453e00 Mon Sep 17 00:00:00 2001 From: Michael Sippel Date: Sat, 15 Oct 2022 04:44:58 +0200 Subject: [PATCH] product editor: fix out-of-bounds in edge case --- nested/src/list/nav.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nested/src/list/nav.rs b/nested/src/list/nav.rs index 67f5930..9728d2f 100644 --- a/nested/src/list/nav.rs +++ b/nested/src/list/nav.rs @@ -118,7 +118,7 @@ where ItemEditor: TerminalTreeEditor + ?Sized + Send + Sync + 'static idx: Some(idx), }); - if new_cur.leaf_mode == ListCursorMode::Select { + if new_cur.leaf_mode == ListCursorMode::Select && self.data.len() > 0 { let item = self.data.get_mut(idx as usize); let mut item_edit = item.write().unwrap(); item_edit.goto(TreeCursor {