summaryrefslogtreecommitdiffstats
path: root/quantum/keymap_introspection.c
diff options
context:
space:
mode:
authorDrashna Jaelre <drashna@live.com>2022-12-31 16:55:14 -0800
committerGitHub <noreply@github.com>2023-01-01 11:55:14 +1100
commitac561b9473559b7880bcf2510ae5a0ac5cabde7a (patch)
tree9341305bf6a04e6c8c9274d023cdc9b83f002dc3 /quantum/keymap_introspection.c
parentd0ebafaea6847926e6391a6920821bcb17b3c39c (diff)
[Bug] Prevent dynamic keymaps from processing layers that don't exist (#19225)
Diffstat (limited to 'quantum/keymap_introspection.c')
-rw-r--r--quantum/keymap_introspection.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/quantum/keymap_introspection.c b/quantum/keymap_introspection.c
index 93aab82fcc..1529ab9fe2 100644
--- a/quantum/keymap_introspection.c
+++ b/quantum/keymap_introspection.c
@@ -17,7 +17,11 @@ uint8_t keymap_layer_count(void) {
return NUM_KEYMAP_LAYERS;
}
+#ifdef DYNAMIC_KEYMAP_ENABLE
+_Static_assert(NUM_KEYMAP_LAYERS <= MAX_LAYER, "Number of keymap layers exceeds maximum set by DYNAMIC_KEYMAP_LAYER_COUNT");
+#else
_Static_assert(NUM_KEYMAP_LAYERS <= MAX_LAYER, "Number of keymap layers exceeds maximum set by LAYER_STATE_(8|16|32)BIT");
+#endif
uint16_t keycode_at_keymap_location_raw(uint8_t layer_num, uint8_t row, uint8_t column) {
if (layer_num < NUM_KEYMAP_LAYERS && row < MATRIX_ROWS && column < MATRIX_COLS) {