Added a check to prevent reading past the end of the keymaps[] array

This relys on the 'LayerCount' variable being correct and defined in
the firmware sketch file (along with 'keymaps')
pull/244/head
Michael Richters 7 years ago
parent 3f1c80366a
commit e7f9edba2d

@ -125,6 +125,11 @@ void Layer_::move(uint8_t layer) {
} }
void Layer_::on(uint8_t layer) { void Layer_::on(uint8_t layer) {
if (layer >= LayerCount) {
// Trying to turn on a layer that doesn't exist; abort
return;
}
bool wasOn = isOn(layer); bool wasOn = isOn(layer);
bitSet(LayerState, layer); bitSet(LayerState, layer);

Loading…
Cancel
Save