Make the HID Report Parser Get/Set Report Item routines fail if a NULL pointer to a report item is given.

Minor visual enhancement to the HIDReportViewer project.
This commit is contained in:
Dean Camera 2011-06-20 01:57:22 +00:00
parent 6599238dab
commit bb0b761c65
2 changed files with 7 additions and 1 deletions

View file

@ -290,6 +290,9 @@ uint8_t USB_ProcessHIDReport(const uint8_t* ReportData,
bool USB_GetHIDReportItemInfo(const uint8_t* ReportData,
HID_ReportItem_t* const ReportItem)
{
if (ReportItem == NULL)
return false;
uint16_t DataBitsRem = ReportItem->Attributes.BitSize;
uint16_t CurrentBit = ReportItem->BitOffset;
uint32_t BitMask = (1 << 0);
@ -320,6 +323,9 @@ bool USB_GetHIDReportItemInfo(const uint8_t* ReportData,
void USB_SetHIDReportItemInfo(uint8_t* ReportData,
HID_ReportItem_t* const ReportItem)
{
if (ReportItem == NULL)
return;
uint16_t DataBitsRem = ReportItem->Attributes.BitSize;
uint16_t CurrentBit = ReportItem->BitOffset;
uint32_t BitMask = (1 << 0);