Skip to content

Commit

Permalink
libusb: Early out if cur_dev is null
Browse files Browse the repository at this point in the history
  • Loading branch information
Megamouse committed Oct 3, 2024
1 parent 15f528e commit 9fab199
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions libusb/hid.c
Original file line number Diff line number Diff line change
Expand Up @@ -548,6 +548,9 @@ static int hid_get_report_descriptor_libusb(libusb_device_handle *handle, int in
*/
static void fill_device_info_usage(struct hid_device_info *cur_dev, libusb_device_handle *handle, int interface_num, uint16_t expected_report_descriptor_size)
{
if (!cur_dev)
return;

unsigned char hid_report_descriptor[HID_API_MAX_REPORT_DESCRIPTOR_SIZE];
unsigned short page = 0, usage = 0;

Expand All @@ -558,10 +561,8 @@ static void fill_device_info_usage(struct hid_device_info *cur_dev, libusb_devic
get_usage(hid_report_descriptor, res, &page, &usage);
}

if (cur_dev) {
cur_dev->usage_page = page;
cur_dev->usage = usage;
}
cur_dev->usage_page = page;
cur_dev->usage = usage;
}

#ifdef INVASIVE_GET_USAGE
Expand Down

0 comments on commit 9fab199

Please sign in to comment.