Fix crash with narrow layouts

The PreferredPos mechanism cause an out of bound access since 773147a.
This commit is contained in:
Jules Aguillon 2024-07-06 13:33:53 +02:00
parent 89d0e6c063
commit 6021a0b83c

View File

@ -96,7 +96,7 @@ public final class KeyboardData
{ {
Row row = rows.get(i_row); Row row = rows.get(i_row);
int i_col = p.col; int i_col = p.col;
int i_col_end = p.col; int i_col_end = Math.min(p.col, row.keys.size() - 1);
if (p.col == -1) { i_col = 0; i_col_end = row.keys.size() - 1; } if (p.col == -1) { i_col = 0; i_col_end = row.keys.size() - 1; }
for (; i_col <= i_col_end; i_col++) for (; i_col <= i_col_end; i_col++)
{ {