Skip to content

Commit

Permalink
Merge pull request #279 from Ultraxime/main
Browse files Browse the repository at this point in the history
Correcting menu (index error when less than 2 items)
  • Loading branch information
genusistimelord authored Aug 18, 2024
2 parents 18cf814 + 2e5bc8d commit f631711
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/widgets/menu/menu_tree.rs
Original file line number Diff line number Diff line change
Expand Up @@ -448,8 +448,8 @@ where

let menu_state = tree.state.downcast_ref::<MenuState>();
let slice = &menu_state.slice;
let max_item_slice = self.items.len() - 1.min(slice.end_index);
let max_tree_slice = tree.children.len() - 1.min(slice.end_index);
let max_item_slice = (self.items.len() - 1).min(slice.end_index);
let max_tree_slice = (tree.children.len() - 1).min(slice.end_index);

self.items[slice.start_index..=max_item_slice]
.iter()
Expand Down

0 comments on commit f631711

Please sign in to comment.