From d1664481c2007745cdd6b61d5b4e60be4757ad00 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Thu, 20 Apr 2017 10:57:09 +0200 Subject: [PATCH] Don't call input_remote_state unless pointer is non-NULL --- input/input_driver.c | 3 ++- input/input_remote.c | 9 ++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/input/input_driver.c b/input/input_driver.c index 5f1bd49bbf..d03621d78a 100644 --- a/input/input_driver.c +++ b/input/input_driver.c @@ -398,7 +398,8 @@ int16_t input_state(unsigned port, unsigned device, #endif #ifdef HAVE_NETWORKGAMEPAD - input_remote_state(&res, port, device, idx, id); + if (input_driver_remote) + input_remote_state(&res, port, device, idx, id); #endif /* Don't allow turbo for D-pad. */ diff --git a/input/input_remote.c b/input/input_remote.c index beb4c237e8..631f0ba50b 100644 --- a/input/input_remote.c +++ b/input/input_remote.c @@ -192,11 +192,6 @@ void input_remote_state( unsigned idx, unsigned id) { - input_remote_state_t *ol_state = input_remote_get_state_ptr(); - - if (!ol_state) - return; - switch (device) { case RETRO_DEVICE_JOYPAD: @@ -206,6 +201,10 @@ void input_remote_state( case RETRO_DEVICE_ANALOG: { unsigned base = 0; + input_remote_state_t *ol_state = input_remote_get_state_ptr(); + + if (!ol_state) + return; if (idx == RETRO_DEVICE_INDEX_ANALOG_RIGHT) base = 2;