mirror of
https://github.com/libsdl-org/SDL.git
synced 2025-10-06 01:46:25 +00:00
Fixed crash if there are no devices available
This commit is contained in:
@@ -811,6 +811,8 @@ hid_device * HID_API_EXPORT hid_open_path(const char *path, int bExclusive)
|
|||||||
process_pending_events();
|
process_pending_events();
|
||||||
|
|
||||||
device_set = IOHIDManagerCopyDevices(hid_mgr);
|
device_set = IOHIDManagerCopyDevices(hid_mgr);
|
||||||
|
if (!device_set)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
num_devices = CFSetGetCount(device_set);
|
num_devices = CFSetGetCount(device_set);
|
||||||
device_array = (IOHIDDeviceRef *)calloc(num_devices, sizeof(IOHIDDeviceRef));
|
device_array = (IOHIDDeviceRef *)calloc(num_devices, sizeof(IOHIDDeviceRef));
|
||||||
|
Reference in New Issue
Block a user