From 8f5281e7e9b418cf51471683afa69ec37c311058 Mon Sep 17 00:00:00 2001 From: Noethix55555 <277300782+Noethix55555@users.noreply.github.com> Date: Wed, 17 Jun 2026 19:45:20 -0400 Subject: [PATCH] fix(taglist): avoid usize underflow on empty tag list --- src/popups/taglist.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/popups/taglist.rs b/src/popups/taglist.rs index 959251b2c0..0f11af1379 100644 --- a/src/popups/taglist.rs +++ b/src/popups/taglist.rs @@ -387,8 +387,10 @@ impl TagListPopup { let mut table_state = self.table_state.take(); let old_selection = table_state.selected().unwrap_or(0); - let max_selection = - self.tags.as_ref().map_or(0, |tags| tags.len() - 1); + let max_selection = self + .tags + .as_ref() + .map_or(0, |tags| tags.len().saturating_sub(1)); let new_selection = match scroll_type { ScrollType::Up => old_selection.saturating_sub(1),