summaryrefslogtreecommitdiff
path: root/play.py
diff options
context:
space:
mode:
authorAdrian C. (anrxc) <anrxc@sysphere.org>2011-03-29 22:28:35 (GMT)
committerAdrian C. (anrxc) <anrxc@sysphere.org>2011-03-29 22:29:19 (GMT)
commit812683927cb25cad1a0c4000a7be1f71bf5a35a6 (patch)
tree089405f38330c25fbe5d9243e3489d28d1598de2 /play.py
parent13d7b1ebe8993b8a6d1101c768683d460c5f35c5 (diff)
downloadplay-812683927cb25cad1a0c4000a7be1f71bf5a35a6.tar.xz
play: handle IndexError in keymap.process
Hit this by pressing Shift+up on an ancient machine: Traceback (most recent call last): if self.methods[key] is None: return 0 IndexError: list index out of range
Diffstat (limited to 'play.py')
-rwxr-xr-xplay.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/play.py b/play.py
index e5c165c..aa8e044 100755
--- a/play.py
+++ b/play.py
@@ -94,7 +94,10 @@ class Keymap:
self.methods[key] = (method, args)
def process(self, key):
- if self.methods[key] is None: return 0
+ try:
+ if self.methods[key] is None: return 0
+ except IndexError:
+ return 0
method, args = self.methods[key]
if args is None: args = (key,)
method(*args)