Explorar el Código

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

David Ludwig hace 6 años
padre
commit
d88f3f5226
Se han modificado 1 ficheros con 1 adiciones y 1 borrados
  1. 1 1
      src/joystick/darwin/SDL_sysjoystick.c

+ 1 - 1
src/joystick/darwin/SDL_sysjoystick.c

@@ -137,7 +137,7 @@ FreeDevice(recDevice *removeDevice)
 
 
         if ( gpDeviceList == removeDevice ) {
         if ( gpDeviceList == removeDevice ) {
             gpDeviceList = pDeviceNext;
             gpDeviceList = pDeviceNext;
-        } else {
+        } else if (gpDeviceList) {
             recDevice *device = gpDeviceList;
             recDevice *device = gpDeviceList;
             while (device->pNext != removeDevice) {
             while (device->pNext != removeDevice) {
                 device = device->pNext;
                 device = device->pNext;