Don't unwrap for unknown keys

This commit is contained in:
Jonathan Turner 2017-04-13 10:23:04 +12:00
parent cf9b927461
commit 1e70d95724

View file

@ -373,11 +373,16 @@ impl Window {
} else {
// Only send the character if we can print it (by ignoring characters like backspace)
if !ch.is_control() {
let event = WindowEvent::KeyEvent(Some(ch),
Window::char_to_script_key(ch).unwrap(),
KeyState::Pressed,
modifiers);
self.event_queue.borrow_mut().push(event);
match Window::char_to_script_key(ch) {
Some(key) => {
let event = WindowEvent::KeyEvent(Some(ch),
key,
KeyState::Pressed,
modifiers);
self.event_queue.borrow_mut().push(event);
}
None => {}
}
}
}
self.last_pressed_key.set(None);