From 940cb0df3dc4d049a6143baf8f4a49a0054adb48 Mon Sep 17 00:00:00 2001 From: Tomas Psika Date: Sat, 22 Aug 2015 14:17:28 +0200 Subject: [PATCH] fix keymap crashes --- cplay | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cplay b/cplay index d94bb87..5511356 100755 --- a/cplay +++ b/cplay @@ -98,7 +98,7 @@ class KeymapStack(Stack): # ------------------------------------------ class Keymap: def __init__(self): - self.methods = [None] * curses.KEY_MAX + self.methods = {} def bind(self, key, method, args=None): if type(key) in (TupleType, ListType): @@ -109,7 +109,7 @@ class Keymap: self.methods[key] = (method, args) def process(self, key): - if self.methods[key] is None: return 0 + if key not in self.methods: return 0 method, args = self.methods[key] if args is None: args = (key,) method(*args)