diff --git a/src/layers.cpp b/src/layers.cpp index c05bde63..694e98c5 100644 --- a/src/layers.cpp +++ b/src/layers.cpp @@ -84,6 +84,9 @@ void Layer_::updateKeyCache(byte row, byte col) { int8_t layer = highestLayer; + if (row >= ROWS || col >= COLS) + return; + for (layer = highestLayer; layer >= DefaultLayer; layer--) { if (Layer.isOn(layer)) { Key mappedKey = (*getKey)(layer, row, col);