Permalink
Browse files

Check for NULL device on enumeration on Mac.

On Mac, hid_enumerate can crash if the device is unplugged during enumeration.

From: Richard Bateman (Taxilian) <taxilian@gmail.com>
  • Loading branch information...
2 parents 0bef94e + d94f682 commit 4f284dc2ec2706678126ff45dcc3ab81abad580e @signal11 signal11 committed with signal11 Aug 9, 2011
Showing with 3 additions and 0 deletions.
  1. +3 −0 mac/hid.c
View
@@ -320,6 +320,9 @@ struct hid_device_info HID_API_EXPORT *hid_enumerate(unsigned short vendor_id,
IOHIDDeviceRef dev = device_array[i];
+ if (!dev) {
+ continue;
+ }
dev_vid = get_vendor_id(dev);
dev_pid = get_product_id(dev);

0 comments on commit 4f284dc

Please sign in to comment.