From d88f3f52260d523c6ff242dc7b289ec20ac834dc Mon Sep 17 00:00:00 2001 From: David Ludwig Date: Wed, 5 Feb 2020 13:16:17 -0500 Subject: [PATCH] macOS: fix crash if and when joystick-init-on-add fails --- src/joystick/darwin/SDL_sysjoystick.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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;