summaryrefslogtreecommitdiff
path: root/cmd2.py
diff options
context:
space:
mode:
authorTodd Leonhardt <todd.leonhardt@gmail.com>2017-06-04 19:27:37 -0400
committerTodd Leonhardt <todd.leonhardt@gmail.com>2017-06-04 19:27:37 -0400
commit007e77701142c552d7b3020e3087f261d2f5ce14 (patch)
treeb54b18830576b80abf9837e567d4accd026d5e67 /cmd2.py
parentccef0b4193297c0b88e8add373f6a49126ffe772 (diff)
downloadcmd2-git-007e77701142c552d7b3020e3087f261d2f5ce14.tar.gz
Fix a bug in history command
This is a bug that was introduced recently when the functionality of the list command was merged with the history command. This prevents an unhandled exception crash under certain unlikely but possible circumstances.
Diffstat (limited to 'cmd2.py')
-rwxr-xr-xcmd2.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/cmd2.py b/cmd2.py
index 3755ef56..13169a17 100755
--- a/cmd2.py
+++ b/cmd2.py
@@ -1610,8 +1610,11 @@ class Cmd(cmd.Cmd):
if arg:
# If a character indicating a slice is present, retrieve a slice of the history
if '..' in arg or ':' in arg:
- # Get a slice of history
- history = self.history.span(arg)
+ try:
+ # Get a slice of history
+ history = self.history.span(arg)
+ except IndexError:
+ history = self.history.get(arg)
else:
# Get item(s) from history by index or string search
history = self.history.get(arg)