summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authormathieui <mathieui@mathieui.net>2013-06-04 13:20:59 +0200
committermathieui <mathieui@mathieui.net>2013-06-04 13:20:59 +0200
commitae009318b2faa4b5f043b6f87353de7123a43409 (patch)
tree24e65524278615d8d939088dc225c1e804203342 /src
parent0abc789403c91de119f917944f7754043f445242 (diff)
downloadpoezio-ae009318b2faa4b5f043b6f87353de7123a43409.tar.gz
poezio-ae009318b2faa4b5f043b6f87353de7123a43409.tar.bz2
poezio-ae009318b2faa4b5f043b6f87353de7123a43409.tar.xz
poezio-ae009318b2faa4b5f043b6f87353de7123a43409.zip
Fix #2299 (invalid characters causing a TB)
any character beyond 0x110000 does not exist and should be dropped
Diffstat (limited to 'src')
-rw-r--r--src/keyboard.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/keyboard.py b/src/keyboard.py
index ffc7dd60..240cc2c8 100644
--- a/src/keyboard.py
+++ b/src/keyboard.py
@@ -92,6 +92,9 @@ def get_char_list_new(s):
except curses.error:
# No input, this means a timeout occurs.
return ret_list
+ except ValueError: # invalid input
+ log.debug('Invalid character entered.')
+ return ret_list
s.timeout(0)
if isinstance(key, int):
ret_list.append(curses.keyname(key).decode())
@@ -104,6 +107,9 @@ def get_char_list_new(s):
part = s.get_wch()
except curses.error:
pass
+ except ValueError: # invalid input
+ log.debug('Invalid character entered.')
+ pass
else:
key = 'M-%s' % part
# and an even more special case for keys like
@@ -114,6 +120,9 @@ def get_char_list_new(s):
part = s.get_wch()
except curses.error:
pass
+ except ValueError:
+ log.debug('Invalid character entered.')
+ pass
else:
key = '%s-%s' % (key, part)
if key == '\x7f' or key == '\x08':