Skip to content

Commit

Permalink
darwin: Don't pass NULL device refs to IOHIDDeviceGetValue().
Browse files Browse the repository at this point in the history
Possibly fixes Bugzilla #4961.
  • Loading branch information
icculus committed Jan 27, 2020
1 parent b4c2e29 commit 059de38
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/joystick/darwin/SDL_sysjoystick.c
Expand Up @@ -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);
Expand Down

0 comments on commit 059de38

Please sign in to comment.