From 53804e5c246ba962836c213fc5ff3719b9851824 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Sun, 13 Dec 2015 13:58:19 +0100 Subject: [PATCH] Fix crash when system info is not yet available --- input/input_keyboard.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/input/input_keyboard.c b/input/input_keyboard.c index bdf82fa2f7..43e43f0ed8 100644 --- a/input/input_keyboard.c +++ b/input/input_keyboard.c @@ -237,9 +237,6 @@ void input_keyboard_event(bool down, unsigned code, uint32_t character, uint16_t mod, unsigned device) { static bool deferred_wait_keys; - rarch_system_info_t *system = NULL; - - runloop_ctl(RUNLOOP_CTL_SYSTEM_INFO_GET, &system); if (deferred_wait_keys) { @@ -283,7 +280,13 @@ void input_keyboard_event(bool down, unsigned code, /* Unblock all hotkeys. */ input_driver_keyboard_mapping_set_block(false); } - else if (system->key_event) - system->key_event(down, code, character, mod); + else + { + rarch_system_info_t *system = NULL; + runloop_ctl(RUNLOOP_CTL_SYSTEM_INFO_GET, &system); + + if (system && system->key_event) + system->key_event(down, code, character, mod); + } }