hidapi/mac: fixed crash on macOS when AirPods are connected

Signed-off-by: Sam Lantinga <slouken@libsdl.org>
main
Sam Lantinga 2023-05-25 08:53:45 -07:00
parent daccd7289b
commit 2fa4b2e78f
1 changed files with 4 additions and 1 deletions

View File

@ -372,11 +372,14 @@ static int get_string_property(IOHIDDeviceRef device, CFStringRef prop, wchar_t
if (!len) if (!len)
return 0; return 0;
if (CFGetTypeID(prop) != CFStringGetTypeID())
return 0;
str = (CFStringRef) IOHIDDeviceGetProperty(device, prop); str = (CFStringRef) IOHIDDeviceGetProperty(device, prop);
buf[0] = 0; buf[0] = 0;
if (str) { if (str && CFGetTypeID(str) == CFStringGetTypeID()) {
CFIndex str_len = CFStringGetLength(str); CFIndex str_len = CFStringGetLength(str);
CFRange range; CFRange range;
CFIndex used_buf_len; CFIndex used_buf_len;