Skip to content

Commit

Permalink
fix(history): don't panic when attempting to view non-existent histor…
Browse files Browse the repository at this point in the history
…y in input field
  • Loading branch information
robertpsoane committed Jun 29, 2024
1 parent 9a8738e commit bb3c41e
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/components/input_field.rs
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,13 @@ impl History {
None => 0,
};

let max_idx = self.values.len() - 1;
let n_values = self.values.len();

if n_values == 0 {
return None;
}

let max_idx = n_values - 1;

if max_idx < next_idx {
next_idx = max_idx
Expand Down

0 comments on commit bb3c41e

Please sign in to comment.