diff options
author | Todd Leonhardt <todd.leonhardt@gmail.com> | 2018-12-13 23:10:51 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-12-13 23:10:51 -0500 |
commit | f5935889c98105538dbf2e4f640ad63c94f2b731 (patch) | |
tree | 3abd0c1dc367956a0ee2b58db445b58686137097 /cmd2/cmd2.py | |
parent | 3efb3f14630d007572a5cf1246bdb78ee63be089 (diff) | |
parent | 259ca0d04ac5c3a4bd28c2a971f3fd0d4d78513a (diff) | |
download | cmd2-git-f5935889c98105538dbf2e4f640ad63c94f2b731.tar.gz |
Merge pull request #612 from python-cmd2/select_zero
Fixed bug in cmd2.Cmd.select() when user enters 0 or negative number
Diffstat (limited to 'cmd2/cmd2.py')
-rw-r--r-- | cmd2/cmd2.py | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/cmd2/cmd2.py b/cmd2/cmd2.py index a513d0e7..56d74ec8 100644 --- a/cmd2/cmd2.py +++ b/cmd2/cmd2.py @@ -2780,6 +2780,8 @@ class Cmd(cmd.Cmd): try: choice = int(response) + if choice < 1: + raise IndexError result = fulloptions[choice - 1][0] break except (ValueError, IndexError): |