mirror of
https://github.com/libretro/RetroArch
synced 2025-01-30 21:32:45 +00:00
(Apple) Put safeguards around input_state/button_pressed functions
This commit is contained in:
parent
9216ca3fd1
commit
88dbe4ee63
4
driver.c
4
driver.c
@ -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
|
||||
|
@ -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)
|
||||
|
Loading…
x
Reference in New Issue
Block a user