Переглянути джерело

Fixed crash if there are no devices available
(cherry picked from commit 679582e702bef0ccd743f07dab860ebce8912856)

Sam Lantinga 3 роки тому
батько
коміт
abac672a2d
1 змінених файлів з 2 додано та 0 видалено
  1. 2 0
      src/hidapi/mac/hid.c

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

@@ -811,6 +811,8 @@ hid_device * HID_API_EXPORT hid_open_path(const char *path, int bExclusive)
 	process_pending_events();
 	
 	device_set = IOHIDManagerCopyDevices(hid_mgr);
+	if (!device_set)
+		return NULL;
 	
 	num_devices = CFSetGetCount(device_set);
 	device_array = (IOHIDDeviceRef *)calloc(num_devices, sizeof(IOHIDDeviceRef));