darwin: Don't pass NULL device refs to IOHIDDeviceGetValue().

Possibly fixes Bugzilla #4961.
This commit is contained in:
Ryan C. Gordon
2020-01-27 15:44:48 -05:00
parent c85a100cd1
commit 895dbc38e2

View File

@@ -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);