From fcd7cc958a51faebf3a4aeab51a83c63349d7a58 Mon Sep 17 00:00:00 2001 From: Twinaphex Date: Wed, 11 Mar 2015 00:43:07 +0100 Subject: [PATCH] (Apple) Make apple_pointer_state somewhat more robust --- input/drivers/apple_input.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/input/drivers/apple_input.c b/input/drivers/apple_input.c index 8a5fabfa3d..4f2a0a1f67 100644 --- a/input/drivers/apple_input.c +++ b/input/drivers/apple_input.c @@ -291,10 +291,15 @@ static int16_t apple_pointer_state(apple_input_data_t *apple, if (idx < apple->touch_count && (idx < MAX_TOUCHES)) { + int16_t x, y; const apple_touch_data_t *touch = (const apple_touch_data_t *) &apple->touches[idx]; - int16_t x = touch->fixed_x; - int16_t y = touch->fixed_y; + + if (!touch) + return 0; + + x = touch->fixed_x; + y = touch->fixed_y; if (want_full) {