diff options
| author | Jules Aguillon | 2025-02-27 22:00:32 +0100 |
|---|---|---|
| committer | Jules Aguillon | 2025-02-27 22:00:32 +0100 |
| commit | ba05b2770e6a9aa79b9b44ad4a3d0fab8f199bd3 (patch) | |
| tree | f614970358f0cc58e2a7edadcb7e77ce874124bf /srcs/juloo.keyboard2 | |
| parent | 44d1343b837315c8b3ce5accd5658e6aca1ecdc0 (diff) | |
| download | unexpected-keyboard-ba05b2770e6a9aa79b9b44ad4a3d0fab8f199bd3.tar.gz unexpected-keyboard-ba05b2770e6a9aa79b9b44ad4a3d0fab8f199bd3.zip | |
Fix crash due to empty strings in keys
Diffstat (limited to 'srcs/juloo.keyboard2')
| -rw-r--r-- | srcs/juloo.keyboard2/ComposeKey.java | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/srcs/juloo.keyboard2/ComposeKey.java b/srcs/juloo.keyboard2/ComposeKey.java index 57b2a4e..9571c03 100644 --- a/srcs/juloo.keyboard2/ComposeKey.java +++ b/srcs/juloo.keyboard2/ComposeKey.java @@ -46,13 +46,15 @@ public final class ComposeKey matched. */ public static KeyValue apply(int prev, String s) { + final int len = s.length(); int i = 0; + if (len == 0) return null; while (true) { KeyValue k = apply(prev, s.charAt(i)); i++; if (k == null) return null; - if (i >= s.length()) return k; + if (i >= len) return k; if (k.getKind() != KeyValue.Kind.Compose_pending) return null; // Found a final state before the end of [s]. prev = k.getPendingCompose(); |
