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
This commit is contained in:
DimitriPilot3 2011-06-15 12:50:47 +00:00
parent 5bdf27d159
commit d4d7e2515f
1 changed files with 4 additions and 3 deletions

View File

@ -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,