diff options
author | Adrian C. (anrxc) <anrxc@sysphere.org> | 2011-03-30 00:28:35 +0200 |
---|---|---|
committer | Adrian C. (anrxc) <anrxc@sysphere.org> | 2011-03-30 00:29:19 +0200 |
commit | 812683927cb25cad1a0c4000a7be1f71bf5a35a6 (patch) | |
tree | 089405f38330c25fbe5d9243e3489d28d1598de2 | |
parent | 13d7b1ebe8993b8a6d1101c768683d460c5f35c5 (diff) | |
download | play-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
-rwxr-xr-x | play.py | 5 |
1 files changed, 4 insertions, 1 deletions
@@ -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) |