Преглед на файлове

Fixed crash if there are no devices available

Sam Lantinga преди 3 години
родител
ревизия
679582e702
променени са 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));