Skip to content

Commit

Permalink
Application panics when ↓ / ↑ is inputted when there is no targets to…
Browse files Browse the repository at this point in the history
… select #188 (#190)
  • Loading branch information
kyu08 authored Jan 4, 2024
1 parent 78a176a commit a8810fc
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/usecase/fzf_make/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,11 @@ impl Model<'_> {
}

fn next(&mut self) {
if self.narrow_down_targets().is_empty() {
self.targets_list_state.select(None);
return;
}

let i = match self.targets_list_state.selected() {
Some(i) => {
if self.narrow_down_targets().len() - 1 <= i {
Expand All @@ -132,6 +137,11 @@ impl Model<'_> {
}

fn previous(&mut self) {
if self.narrow_down_targets().is_empty() {
self.targets_list_state.select(None);
return;
}

let i = match self.targets_list_state.selected() {
Some(i) => {
if i == 0 {
Expand Down

0 comments on commit a8810fc

Please sign in to comment.