summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNick Brassel <nick@tzarc.org>2023-06-15 13:48:19 +1000
committerGitHub <noreply@github.com>2023-06-14 20:48:19 -0700
commit6c7c5889ca04959c3ce2448d6ca07545b9811e4d (patch)
tree435d40aab7c8f72d292a74d9f26f5d3b0dd0ae00
parent88d9b7ee312096fa614142f4c207d72eca629ac7 (diff)
Rely on introspection to handle OOB access. (#21247)
-rw-r--r--quantum/dynamic_keymap.c15
1 files changed, 3 insertions, 12 deletions
diff --git a/quantum/dynamic_keymap.c b/quantum/dynamic_keymap.c
index 90a0f20838..2030c82a1b 100644
--- a/quantum/dynamic_keymap.c
+++ b/quantum/dynamic_keymap.c
@@ -152,22 +152,13 @@ void dynamic_keymap_reset(void) {
for (int layer = 0; layer < DYNAMIC_KEYMAP_LAYER_COUNT; layer++) {
for (int row = 0; row < MATRIX_ROWS; row++) {
for (int column = 0; column < MATRIX_COLS; column++) {
- if (layer < keymap_layer_count()) {
- dynamic_keymap_set_keycode(layer, row, column, keycode_at_keymap_location_raw(layer, row, column));
- } else {
- dynamic_keymap_set_keycode(layer, row, column, KC_TRANSPARENT);
- }
+ dynamic_keymap_set_keycode(layer, row, column, keycode_at_keymap_location_raw(layer, row, column));
}
}
#ifdef ENCODER_MAP_ENABLE
for (int encoder = 0; encoder < NUM_ENCODERS; encoder++) {
- if (layer < encodermap_layer_count()) {
- dynamic_keymap_set_encoder(layer, encoder, true, keycode_at_encodermap_location_raw(layer, encoder, true));
- dynamic_keymap_set_encoder(layer, encoder, false, keycode_at_encodermap_location_raw(layer, encoder, false));
- } else {
- dynamic_keymap_set_encoder(layer, encoder, true, KC_TRANSPARENT);
- dynamic_keymap_set_encoder(layer, encoder, false, KC_TRANSPARENT);
- }
+ dynamic_keymap_set_encoder(layer, encoder, true, keycode_at_encodermap_location_raw(layer, encoder, true));
+ dynamic_keymap_set_encoder(layer, encoder, false, keycode_at_encodermap_location_raw(layer, encoder, false));
}
#endif // ENCODER_MAP_ENABLE
}