summaryrefslogtreecommitdiff
path: root/Source/Core/InputCommon
diff options
context:
space:
mode:
Diffstat (limited to 'Source/Core/InputCommon')
-rw-r--r--Source/Core/InputCommon/Src/ControllerInterface/OSX/OSX.mm7
1 files changed, 4 insertions, 3 deletions
diff --git a/Source/Core/InputCommon/Src/ControllerInterface/OSX/OSX.mm b/Source/Core/InputCommon/Src/ControllerInterface/OSX/OSX.mm
index 5c5143fdb2..bf4f49bac6 100644
--- a/Source/Core/InputCommon/Src/ControllerInterface/OSX/OSX.mm
+++ b/Source/Core/InputCommon/Src/ControllerInterface/OSX/OSX.mm
@@ -137,8 +137,9 @@ static void DeviceMatching_callback(void* inContext,
void *inSender,
IOHIDDeviceRef inIOHIDDeviceRef)
{
- std::string name = [(NSString *)IOHIDDeviceGetProperty(inIOHIDDeviceRef,
- CFSTR(kIOHIDProductKey)) UTF8String];
+ NSString *pName = (NSString *)
+ IOHIDDeviceGetProperty(inIOHIDDeviceRef, CFSTR(kIOHIDProductKey));
+ std::string name = (pName != NULL) ? [pName UTF8String] : "Unknown device";
DeviceDebugPrint(inIOHIDDeviceRef);
@@ -154,7 +155,7 @@ static void DeviceMatching_callback(void* inContext,
else if (IOHIDDeviceConformsTo(inIOHIDDeviceRef,
kHIDPage_GenericDesktop, kHIDUsage_GD_Mouse))
devices->push_back(new Mouse(inIOHIDDeviceRef,
- name, mouse_name_counts[name++]));
+ name, mouse_name_counts[name]++));
#endif
else
devices->push_back(new Joystick(inIOHIDDeviceRef,