Merge pull request #3165 from ledvinap/fix-IOGetByTag-bf

IOGetByTag did not handle empty Tag correctly
This commit is contained in:
Martin Budden 2017-05-28 14:40:17 +01:00 committed by GitHub
commit a1df39b67b
1 changed files with 1 additions and 1 deletions

View File

@ -389,7 +389,7 @@ IO_t IOGetByTag(ioTag_t tag)
int portIdx = DEFIO_TAG_GPIOID(tag);
int pinIdx = DEFIO_TAG_PIN(tag);
if (portIdx >= DEFIO_PORT_USED_COUNT)
if (portIdx < 0 || portIdx >= DEFIO_PORT_USED_COUNT)
return NULL;
// check if pin exists
if (!(ioDefUsedMask[portIdx] & (1 << pinIdx)))