diff options
author | Akshay <[email protected]> | 2021-03-24 07:33:45 +0000 |
---|---|---|
committer | Akshay <[email protected]> | 2021-03-24 07:33:45 +0000 |
commit | 0c3b0c10791c332537b4050e33429feb09db7c62 (patch) | |
tree | dad7b2df93cf56b4c5e2addaff53d05d7138da91 | |
parent | 305bf638f823a41f391936712eef302bc6733d00 (diff) |
fix empty history panic
-rw-r--r-- | src/command.rs | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/command.rs b/src/command.rs index d80f1f2..f5a24c9 100644 --- a/src/command.rs +++ b/src/command.rs | |||
@@ -81,6 +81,9 @@ impl CommandBox { | |||
81 | } | 81 | } |
82 | 82 | ||
83 | pub fn hist_prev(&mut self) { | 83 | pub fn hist_prev(&mut self) { |
84 | if self.history.items.is_empty() { | ||
85 | return; | ||
86 | } | ||
84 | if let Some(idx) = self.hist_idx { | 87 | if let Some(idx) = self.hist_idx { |
85 | if !(idx + 1 >= self.history.items.len()) { | 88 | if !(idx + 1 >= self.history.items.len()) { |
86 | self.hist_idx = Some(idx + 1); | 89 | self.hist_idx = Some(idx + 1); |