Explorar el Código

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

Possibly fixes Bugzilla #4961.
Ryan C. Gordon hace 6 años
padre
commit
059de38c2c
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

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