Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix out of range error when traversing menus #269

Merged
merged 1 commit into from
Jul 21, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/widgets/menu/menu_tree.rs
Original file line number Diff line number Diff line change
Expand Up @@ -387,11 +387,11 @@
) -> mouse::Interaction {
let mut lc = layout.children();
let slice_layout = lc.next().unwrap();

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
Loading