diff --git a/src/joystick/darwin/SDL_sysjoystick.c b/src/joystick/darwin/SDL_sysjoystick.c index 390044098..461a85f18 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;