Procházet zdrojové kódy

Fixed crash on macOS when AirPods are connected

Sam Lantinga před 4 roky
rodič
revize
1133ea0349
1 změnil soubory, kde provedl 7 přidání a 1 odebrání
  1. 7 1
      src/hidapi/mac/hid.c

+ 7 - 1
src/hidapi/mac/hid.c

@@ -251,7 +251,10 @@ static int get_string_property(IOHIDDeviceRef device, CFStringRef prop, wchar_t
 	
 	if (!len)
 		return 0;
-	
+
+	if (CFGetTypeID(prop) != CFStringGetTypeID())
+		return 0;
+
 	str = (CFStringRef)IOHIDDeviceGetProperty(device, prop);
 	
 	buf[0] = 0;
@@ -288,6 +291,9 @@ static int get_string_property_utf8(IOHIDDeviceRef device, CFStringRef prop, cha
 	if (!len)
 		return 0;
 	
+	if (CFGetTypeID(prop) != CFStringGetTypeID())
+		return 0;
+
 	str = (CFStringRef)IOHIDDeviceGetProperty(device, prop);
 	
 	buf[0] = 0;