diff --git a/src/components/input_field.rs b/src/components/input_field.rs index a0e2d51..fbcbac2 100644 --- a/src/components/input_field.rs +++ b/src/components/input_field.rs @@ -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