Skip to content

Commit

Permalink
allow to close the list popup if there is no item
Browse files Browse the repository at this point in the history
  • Loading branch information
aome510 committed Nov 16, 2021
1 parent 11c7a38 commit acb8b6b
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions spotify_player/src/event/popup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -335,9 +335,6 @@ fn handle_key_sequence_for_list_popup(

let popup = ui.popup.as_mut().unwrap();
let current_id = popup.list_selected().unwrap_or_default();
if current_id >= n_items {
return Ok(false);
}

match command {
Command::SelectPreviousOrScrollUp => {
Expand All @@ -353,7 +350,9 @@ fn handle_key_sequence_for_list_popup(
}
}
Command::ChooseSelected => {
on_choose_func(&mut ui, current_id)?;
if current_id < n_items {
on_choose_func(&mut ui, current_id)?;
}
}
Command::ClosePopup => {
on_close_func(&mut ui);
Expand Down

0 comments on commit acb8b6b

Please sign in to comment.