Explorar o código

Make sure the string properties are actually strings (thanks Nat!)

Sam Lantinga %!s(int64=4) %!d(string=hai) anos
pai
achega
09b652b70a
Modificáronse 1 ficheiros con 2 adicións e 2 borrados
  1. 2 2
      src/hidapi/mac/hid.c

+ 2 - 2
src/hidapi/mac/hid.c

@@ -259,7 +259,7 @@ static int get_string_property(IOHIDDeviceRef device, CFStringRef prop, wchar_t
 	
 	
 	buf[0] = 0;
 	buf[0] = 0;
 	
 	
-	if (str) {
+	if (str && CFGetTypeID(str) == CFStringGetTypeID()) {
 		len --;
 		len --;
 		
 		
 		CFIndex str_len = CFStringGetLength(str);
 		CFIndex str_len = CFStringGetLength(str);
@@ -298,7 +298,7 @@ static int get_string_property_utf8(IOHIDDeviceRef device, CFStringRef prop, cha
 	
 	
 	buf[0] = 0;
 	buf[0] = 0;
 	
 	
-	if (str) {
+	if (str && CFGetTypeID(str) == CFStringGetTypeID()) {
 		len--;
 		len--;
 		
 		
 		CFIndex str_len = CFStringGetLength(str);
 		CFIndex str_len = CFStringGetLength(str);