diff --git a/tui/src/state.rs b/tui/src/state.rs index 9f2a70c1..b9690fe5 100644 --- a/tui/src/state.rs +++ b/tui/src/state.rs @@ -512,6 +512,9 @@ impl AppState { fn scroll_down(&mut self) { let len = self.filter.item_list().len(); + if len == 0 { + return; + } let current = self.selection.selected().unwrap_or(0); let max_index = if self.at_root() { len - 1 } else { len }; let next = if current + 1 > max_index { @@ -525,6 +528,9 @@ impl AppState { fn scroll_up(&mut self) { let len = self.filter.item_list().len(); + if len == 0 { + return; + } let current = self.selection.selected().unwrap_or(0); let max_index = if self.at_root() { len - 1 } else { len }; let next = if current == 0 { max_index } else { current - 1 };