Skip to content

Commit

Permalink
Merge pull request #269 from shartrec/menu_fix
Browse files Browse the repository at this point in the history
Fix out of range error when traversing menus
  • Loading branch information
genusistimelord authored Jul 21, 2024
2 parents 168c252 + 42357b9 commit a1a897c
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 @@ -390,8 +390,8 @@ where

Check failure on line 390 in src/widgets/menu/menu_tree.rs

View workflow job for this annotation

GitHub Actions / all

Diff in /home/runner/work/iced_aw/iced_aw/src/widgets/menu/menu_tree.rs

Check failure on line 390 in src/widgets/menu/menu_tree.rs

View workflow job for this annotation

GitHub Actions / all

Diff in /home/runner/work/iced_aw/iced_aw/src/widgets/menu/menu_tree.rs
let menu_state = tree.state.downcast_ref::<MenuState>();
let slice = &menu_state.slice;
let max_item_slice = self.items.len().min(slice.end_index);
let max_tree_slice = tree.children.len().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 a1a897c

Please sign in to comment.