From 05a1029bbdf46042b7b23e3e99b63a6d3eee63bd Mon Sep 17 00:00:00 2001 From: Niek van der Maas Date: Fri, 8 Nov 2019 23:51:52 +0100 Subject: [PATCH] Fix out_of_range exception on bitset.test (#1977) --- code/espurna/gpio.ino | 2 ++ 1 file changed, 2 insertions(+) diff --git a/code/espurna/gpio.ino b/code/espurna/gpio.ino index f647d48c..e66e02d6 100644 --- a/code/espurna/gpio.ino +++ b/code/espurna/gpio.ino @@ -14,6 +14,8 @@ std::bitset _gpio_locked; std::bitset _gpio_available; bool gpioValid(unsigned char gpio) { + if (gpio >= GPIO_PINS) return false; + return _gpio_available.test(gpio); }