From 1e751d00eaca933fd11ad3aafd7662c0426898b3 Mon Sep 17 00:00:00 2001 From: A Schain Date: Thu, 30 Apr 2020 13:27:44 -0400 Subject: [PATCH] In case last hatswitch does not match cookie For the mayflash N64 adapter, I was getting a BAD EXC ADDRESS (in mac OS 10.13) for this line (tmp was NULL). Retroarch would crash in the gui if I pressed a button from the DPAD on controller 2. With this change, it no longer crashes in the gui and still registers the button push. --- input/drivers_hid/iohidmanager_hid.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/input/drivers_hid/iohidmanager_hid.c b/input/drivers_hid/iohidmanager_hid.c index 49893b3151..da2a99f16a 100644 --- a/input/drivers_hid/iohidmanager_hid.c +++ b/input/drivers_hid/iohidmanager_hid.c @@ -290,7 +290,7 @@ static void iohidmanager_hid_device_input_callback(void *data, IOReturn result, while (tmp && tmp->cookie != (IOHIDElementCookie)cookie) tmp = tmp->next; - if (tmp->cookie == (IOHIDElementCookie)cookie) + if (tmp && tmp->cookie == (IOHIDElementCookie)cookie) { CFIndex min = IOHIDElementGetLogicalMin(element); CFIndex range = IOHIDElementGetLogicalMax(element) - min;