Skip to content

Commit

Permalink
fix: Fixed scrolling with no elements in the list
Browse files Browse the repository at this point in the history
  • Loading branch information
PiotrekPKP committed May 21, 2022
1 parent b3dc002 commit a672ef3
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/window/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ impl Window {
Inhibit(false)
}
KEY_DOWN_ARROW => {
let new_selection = std::cmp::min(selection_model.n_items() - 1, selection_model.selected() + 1);
let new_selection = if selection_model.n_items() > 0 { std::cmp::min(selection_model.n_items() - 1, selection_model.selected() + 1) } else { 0 };
selection_model.select_item(new_selection, true);
window.imp().crab_items_list.activate_action("list.scroll-to-item", Some(&new_selection.to_variant())).unwrap();

Expand Down

0 comments on commit a672ef3

Please sign in to comment.