(iOS) Add more safeguards in apple_touch_event and apple_input_keyboard

event
This commit is contained in:
Twinaphex 2014-10-07 04:15:18 +02:00
parent 88dbe4ee63
commit 945376ab2d
2 changed files with 5 additions and 1 deletions

View File

@ -77,6 +77,9 @@ static void handle_touch_event(NSArray* touches)
apple_input_data_t *apple = (apple_input_data_t*)driver.input_data;
const float scale = [[UIScreen mainScreen] scale];
if (!apple)
return;
apple->touch_count = 0;
for(i = 0; i < touches.count && (apple->touch_count < MAX_TOUCHES); i ++)

View File

@ -284,7 +284,8 @@ void apple_input_keyboard_event(bool down,
if (code == 0 || code >= MAX_KEYS)
return;
apple->key_state[code] = down;
if (apple)
apple->key_state[code] = down;
mods |= (mod & NSAlphaShiftKeyMask) ? RETROKMOD_CAPSLOCK : 0;
mods |= (mod & NSShiftKeyMask) ? RETROKMOD_SHIFT : 0;