Fixed typo in JoystickImpl.cpp to prevent crash on OS X

This commit is contained in:
Marco Antognini 2015-01-07 00:30:54 +01:00 committed by Lukas Dürrenberger
parent b7c0af3a58
commit 8a8793e00c

View File

@ -53,7 +53,7 @@ namespace
std::string getDeviceString(IOHIDDeviceRef ref, CFStringRef prop, unsigned int index) std::string getDeviceString(IOHIDDeviceRef ref, CFStringRef prop, unsigned int index)
{ {
CFTypeRef typeRef = IOHIDDeviceGetProperty(ref, prop); CFTypeRef typeRef = IOHIDDeviceGetProperty(ref, prop);
if (ref && (CFGetTypeID(typeRef) == CFStringGetTypeID())) if (typeRef && (CFGetTypeID(typeRef) == CFStringGetTypeID()))
{ {
CFStringRef str = static_cast<CFStringRef>(typeRef); CFStringRef str = static_cast<CFStringRef>(typeRef);
return stringFromCFString(str); return stringFromCFString(str);
@ -68,7 +68,7 @@ namespace
unsigned int getDeviceUint(IOHIDDeviceRef ref, CFStringRef prop, unsigned int index) unsigned int getDeviceUint(IOHIDDeviceRef ref, CFStringRef prop, unsigned int index)
{ {
CFTypeRef typeRef = IOHIDDeviceGetProperty(ref, prop); CFTypeRef typeRef = IOHIDDeviceGetProperty(ref, prop);
if (ref && (CFGetTypeID(typeRef) == CFNumberGetTypeID())) if (typeRef && (CFGetTypeID(typeRef) == CFNumberGetTypeID()))
{ {
SInt32 value; SInt32 value;
CFNumberGetValue((CFNumberRef)typeRef, kCFNumberSInt32Type, &value); CFNumberGetValue((CFNumberRef)typeRef, kCFNumberSInt32Type, &value);