Commit d88f3f52260d523c6ff242dc7b289ec20ac834dc

David Ludwig 2020-02-05T13:16:17

macOS: fix crash if and when joystick-init-on-add fails

1
2
3
4
5
6
7
8
9
10
11
12
13
diff --git a/src/joystick/darwin/SDL_sysjoystick.c b/src/joystick/darwin/SDL_sysjoystick.c
index 3900440..461a85f 100644
--- a/src/joystick/darwin/SDL_sysjoystick.c
+++ b/src/joystick/darwin/SDL_sysjoystick.c
@@ -137,7 +137,7 @@ FreeDevice(recDevice *removeDevice)
 
         if ( gpDeviceList == removeDevice ) {
             gpDeviceList = pDeviceNext;
-        } else {
+        } else if (gpDeviceList) {
             recDevice *device = gpDeviceList;
             while (device->pNext != removeDevice) {
                 device = device->pNext;