diff options
| author | DimitriPilot3 <DimitriPilot3@gmail.com> | 2011-06-15 12:50:47 +0000 |
|---|---|---|
| committer | DimitriPilot3 <DimitriPilot3@gmail.com> | 2011-06-15 12:50:47 +0000 |
| commit | d4d7e2515ffbd34bf32f6a56bd5c69aa38f0a507 (patch) | |
| tree | 299fcee1b8f15069ec374db1d1994f03cf24bb5b /Source/Core/InputCommon | |
| parent | 5bdf27d159c131677ef64ba2760029288bcd24cd (diff) | |
Apply the simple NULL-checking patch from issue 4311.
Judging by the feedback provided by other OSX users, this appears to fix the crash when starting Dolphin on OSX with devices that have an empty name.
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@7598 8ced0084-cf51-0410-be5f-012b33b47a6e
Diffstat (limited to 'Source/Core/InputCommon')
| -rw-r--r-- | Source/Core/InputCommon/Src/ControllerInterface/OSX/OSX.mm | 7 |
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, |
