IOGetByTag did not handle empty Tag correctly

This commit is contained in:
Petr Ledvina 2017-05-28 14:38:16 +02:00
parent 63aa212efa
commit 5fc2b4a8ac
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)))