diff --git a/src/arch/InputHandler/InputHandler_MacOSX_HID.mm b/src/arch/InputHandler/InputHandler_MacOSX_HID.mm index 56dc1f6c72..be296162cd 100644 --- a/src/arch/InputHandler/InputHandler_MacOSX_HID.mm +++ b/src/arch/InputHandler/InputHandler_MacOSX_HID.mm @@ -450,7 +450,7 @@ wchar_t InputHandler_MacOSX_HID::DeviceButtonToChar( DeviceButton button, bool b { CGEventRef event = CGEventCreate(nullptr); CGEventFlags mods = CGEventGetFlags(event); - CFRelease(event); + CFRelease(event); UInt32 nModifiers = bUseCurrentKeyModifiers ? (UInt32)mods : 0; wchar_t sCharCode = KeyCodeToChar( iMacVirtualKey, nModifiers ); if( sCharCode != 0 ) diff --git a/src/archutils/Darwin/KeyboardDevice.cpp b/src/archutils/Darwin/KeyboardDevice.cpp index 5db6f84b4d..46e8663e17 100644 --- a/src/archutils/Darwin/KeyboardDevice.cpp +++ b/src/archutils/Darwin/KeyboardDevice.cpp @@ -482,7 +482,14 @@ bool KeyboardDevice::DeviceButtonToMacVirtualKey( DeviceButton button, UInt8 &iM } bInited = true; } - iMacVKOut = g_iDeviceButtonToMacVirtualKey[button]; + if (button < sizeof(g_iDeviceButtonToMacVirtualKey)) + { + iMacVKOut = g_iDeviceButtonToMacVirtualKey[button]; + } + else + { + iMacVKOut = 0xFF; + } return iMacVKOut != 0xFF; }