From 6021a0b83c33a495fedde7bbb751ad3e3754bd98 Mon Sep 17 00:00:00 2001 From: Jules Aguillon Date: Sat, 6 Jul 2024 13:33:53 +0200 Subject: [PATCH] Fix crash with narrow layouts The PreferredPos mechanism cause an out of bound access since 773147a. --- srcs/juloo.keyboard2/KeyboardData.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/srcs/juloo.keyboard2/KeyboardData.java b/srcs/juloo.keyboard2/KeyboardData.java index 8119f21..68ebd10 100644 --- a/srcs/juloo.keyboard2/KeyboardData.java +++ b/srcs/juloo.keyboard2/KeyboardData.java @@ -96,7 +96,7 @@ public final class KeyboardData { Row row = rows.get(i_row); 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; } for (; i_col <= i_col_end; i_col++) {