Mercurial > repos > blastem
changeset 1488:f29bd94ffa76 nuklear_ui
Don't crash when keys are pressed before ROM is loaded
author | Michael Pavone <pavone@retrodev.com> |
---|---|
date | Sun, 26 Nov 2017 20:19:36 -0800 |
parents | 6a35815cc409 |
children | 637fbc3b5063 |
files | io.c |
diffstat | 1 files changed, 6 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/io.c Sun Nov 26 20:17:22 2017 -0800 +++ b/io.c Sun Nov 26 20:19:36 2017 -0800 @@ -360,6 +360,9 @@ 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_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;