(Apple) Put safeguards around input_state/button_pressed functions

This commit is contained in:
twinaphex 2014-10-07 04:12:41 +02:00
parent 9216ca3fd1
commit 88dbe4ee63
2 changed files with 7 additions and 6 deletions

View File

@ -28,10 +28,6 @@
#include "audio/audio_thread_wrapper.h"
#include "gfx/gfx_common.h"
#ifdef HAVE_X11
#include "gfx/context/x11_common.h"
#endif
#ifdef HAVE_MENU
#include "frontend/menu/menu_common.h"
#endif

View File

@ -463,6 +463,9 @@ static int16_t apple_input_state(void *data,
{
apple_input_data_t *apple = (apple_input_data_t*)data;
if (!apple || !apple->joypad)
return 0;
switch (device)
{
case RETRO_DEVICE_JOYPAD:
@ -489,8 +492,10 @@ static int16_t apple_input_state(void *data,
static bool apple_input_bind_button_pressed(void *data, int key)
{
apple_input_data_t *apple = (apple_input_data_t*)data;
return apple_input_is_pressed(apple, 0, g_settings.input.binds[0], key) ||
input_joypad_pressed(apple->joypad, 0, g_settings.input.binds[0], key);
if (apple && apple->joypad)
return apple_input_is_pressed(apple, 0, g_settings.input.binds[0], key) ||
input_joypad_pressed(apple->joypad, 0, g_settings.input.binds[0], key);
return false;
}
static void apple_input_free(void *data)