diff --git a/Source/Core/InputCommon/Src/ControllerInterface/OSX/OSXJoystick.mm b/Source/Core/InputCommon/Src/ControllerInterface/OSX/OSXJoystick.mm index 418e4f4ef0..56ca3e55a6 100644 --- a/Source/Core/InputCommon/Src/ControllerInterface/OSX/OSXJoystick.mm +++ b/Source/Core/InputCommon/Src/ControllerInterface/OSX/OSXJoystick.mm @@ -75,8 +75,6 @@ Joystick::Joystick(IOHIDDeviceRef device, std::string name, int index) ControlState Joystick::GetInputState( const ControllerInterface::Device::Input* const input) const { - if (input == NULL) // XXX - return 0; return ((Input*)input)->GetState(m_device); } @@ -182,6 +180,11 @@ ControlState Joystick::Axis::GetState(IOHIDDeviceRef device) const if (IOHIDDeviceGetValue(device, m_element, &value) == kIOReturnSuccess) { + // IOHIDValueGetIntegerValue() crashes when trying + // to convert unusually large element values. + if (IOHIDValueGetLength(value) > 2) + return 0; + float position = IOHIDValueGetIntegerValue(value); if (m_direction == positive && position > m_neutral)