From 5fc2b4a8ac467e7afccfef965916fcdb1ed3841c Mon Sep 17 00:00:00 2001 From: Petr Ledvina Date: Sun, 28 May 2017 14:38:16 +0200 Subject: [PATCH] IOGetByTag did not handle empty Tag correctly --- src/main/drivers/io.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/drivers/io.c b/src/main/drivers/io.c index 8b08a2088..51ead6da5 100644 --- a/src/main/drivers/io.c +++ b/src/main/drivers/io.c @@ -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)))