diff options
author | Michael Pavone <pavone@retrodev.com> | 2017-11-26 20:19:36 -0800 |
---|---|---|
committer | Michael Pavone <pavone@retrodev.com> | 2017-11-26 20:19:36 -0800 |
commit | d064c9a6c6ea4aff356b5cde90f5afc92cb705f4 (patch) | |
tree | efe7f33de90745c696a707ee02157f8d9fd5425b | |
parent | 4a9e985267f3c88b480f9f3b3d07e4a0c70716ae (diff) |
Don't crash when keys are pressed before ROM is loaded
--HG--
branch : nuklear_ui
-rw-r--r-- | io.c | 6 |
1 files changed, 6 insertions, 0 deletions
@@ -360,6 +360,9 @@ void store_key_event(uint16_t code) void handle_keydown(int keycode, uint8_t scancode) { + if (!current_io) { + return; + } int bucket = keycode >> 15 & 0xFFFF; int idx = keycode & 0x7FFF; keybinding * binding = bindings[bucket] ? bindings[bucket] + idx : NULL; @@ -564,6 +567,9 @@ void handle_binding_up(keybinding * binding) void handle_keyup(int keycode, uint8_t scancode) { + if (!current_io) { + return; + } int bucket = keycode >> 15 & 0xFFFF; int idx = keycode & 0x7FFF; keybinding * binding = bindings[bucket] ? bindings[bucket] + idx : NULL; |