diff --git a/src/kaleidoscope/KeyAddrEventQueue.h b/src/kaleidoscope/KeyAddrEventQueue.h index 326b84e5..214e535a 100644 --- a/src/kaleidoscope/KeyAddrEventQueue.h +++ b/src/kaleidoscope/KeyAddrEventQueue.h @@ -103,6 +103,8 @@ class KeyAddrEventQueue { // rather than using a ring buffer because we expect it will be called much // less often than the queue is searched via a for loop. void remove(uint8_t n = 0) { + if (n >= length_ || length_ == 0) + return; // assert(length > n); --length_; for (uint8_t i{n}; i < length_; ++i) {