Guard against out-of-bounds layer

pull/365/head
James N. V. Cash 7 years ago
parent e4cf2e4c75
commit 480bfbd021

@ -113,6 +113,9 @@ bool EEPROMKeymap::focusKeymapLayer(const char *command) {
} }
uint8_t layer = Serial.parseInt(); uint8_t layer = Serial.parseInt();
if (layer >= max_layers_) {
return false;
}
uint16_t keysPerLayer = ROWS * COLS; uint16_t keysPerLayer = ROWS * COLS;
uint16_t offset = layer * keysPerLayer; uint16_t offset = layer * keysPerLayer;
if (Serial.peek() == '\n') { if (Serial.peek() == '\n') {

Loading…
Cancel
Save