From 0c3b0c10791c332537b4050e33429feb09db7c62 Mon Sep 17 00:00:00 2001 From: Akshay Date: Wed, 24 Mar 2021 13:03:45 +0530 Subject: fix empty history panic --- src/command.rs | 3 +++ 1 file changed, 3 insertions(+) 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 { } pub fn hist_prev(&mut self) { + if self.history.items.is_empty() { + return; + } if let Some(idx) = self.hist_idx { if !(idx + 1 >= self.history.items.len()) { self.hist_idx = Some(idx + 1); -- cgit v1.2.3