From 059de38c2c7fcb3dac5fcd94e585a98c84e41313 Mon Sep 17 00:00:00 2001 From: "Ryan C. Gordon" Date: Mon, 27 Jan 2020 15:44:48 -0500 Subject: [PATCH] darwin: Don't pass NULL device refs to IOHIDDeviceGetValue(). Possibly fixes Bugzilla #4961. --- 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 fc3ff31ba..49d9b1597 100644 --- a/src/joystick/darwin/SDL_sysjoystick.c +++ b/src/joystick/darwin/SDL_sysjoystick.c @@ -161,7 +161,7 @@ GetHIDElementState(recDevice *pDevice, recElement *pElement, SInt32 *pValue) SInt32 value = 0; int returnValue = SDL_FALSE; - if (pDevice && pElement) { + if (pDevice && pDevice->deviceRef && pElement) { IOHIDValueRef valueRef; if (IOHIDDeviceGetValue(pDevice->deviceRef, pElement->elementRef, &valueRef) == kIOReturnSuccess) { value = (SInt32) IOHIDValueGetIntegerValue(valueRef);