From 812683927cb25cad1a0c4000a7be1f71bf5a35a6 Mon Sep 17 00:00:00 2001 From: "Adrian C. (anrxc)" Date: Wed, 30 Mar 2011 00:28:35 +0200 Subject: 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 --- play.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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) -- cgit v1.2.3