summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorQMK Bot <hello@qmk.fm>2023-12-05 13:32:43 +0000
committerQMK Bot <hello@qmk.fm>2023-12-05 13:32:43 +0000
commitca2e424b75eeea3bd57bee1f76ee36b1d6bb695c (patch)
tree10598a838b4429add2b0a1cd187fdc9dc159bdfa /lib
parent17f36a21bfc340e4715c5849e4d0c537820e7cbe (diff)
parentbba5c14933274d47c88140106de13b1ce9391b01 (diff)
Merge remote-tracking branch 'origin/master' into develop
Diffstat (limited to 'lib')
-rwxr-xr-xlib/python/qmk/cli/generate/keyboard_c.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/python/qmk/cli/generate/keyboard_c.py b/lib/python/qmk/cli/generate/keyboard_c.py
index f8a2372cf3..f010341613 100755
--- a/lib/python/qmk/cli/generate/keyboard_c.py
+++ b/lib/python/qmk/cli/generate/keyboard_c.py
@@ -64,12 +64,15 @@ def _gen_matrix_mask(info_data):
rows = info_data['matrix_size']['rows']
# Default mask to everything disabled
- mask = [['0'] * cols for i in range(rows)]
+ mask = [['0'] * cols for _ in range(rows)]
# Mirror layout macros squashed on top of each other
- for layout_data in info_data['layouts'].values():
+ for layout_name, layout_data in info_data['layouts'].items():
for key_data in layout_data['layout']:
row, col = key_data['matrix']
+ if row >= rows or col >= cols:
+ cli.log.error(f'Skipping matrix_mask due to {layout_name} containing invalid matrix values')
+ return []
mask[row][col] = '1'
lines = []