Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid exceptions when generating matrix mask from layouts containing OOB matrix values #22609

Merged
merged 1 commit into from
Dec 5, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions lib/python/qmk/cli/generate/keyboard_c.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = []
Expand Down