diff options
| author | Jules Aguillon | 2024-01-10 00:17:09 +0100 |
|---|---|---|
| committer | Jules Aguillon | 2024-01-10 00:17:09 +0100 |
| commit | b319356a08ee059fd4c3fbcc7242b2d8712fa420 (patch) | |
| tree | 4c97752aafa1c3c6feef485b0be15634a26734cd /srcs/juloo.keyboard2 | |
| parent | 73267d68fb3ba04a5233a605a10969a8a9052961 (diff) | |
| download | unexpected-keyboard-b319356a08ee059fd4c3fbcc7242b2d8712fa420.tar.gz unexpected-keyboard-b319356a08ee059fd4c3fbcc7242b2d8712fa420.zip | |
Fix crash on shift with empty keys
Tapping shift might call `Utils.capitalize_string` on some symbols
(notably custom keys), which crashes on empty string.
This also happens on builtin layouts with `key1="\"`.
Diffstat (limited to 'srcs/juloo.keyboard2')
| -rw-r--r-- | srcs/juloo.keyboard2/Utils.java | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/srcs/juloo.keyboard2/Utils.java b/srcs/juloo.keyboard2/Utils.java index 28bd9e3..0eee945 100644 --- a/srcs/juloo.keyboard2/Utils.java +++ b/srcs/juloo.keyboard2/Utils.java @@ -12,6 +12,8 @@ class Utils /** Turn the first letter of a string uppercase. */ public static String capitalize_string(String s) { + if (s.length() < 1) + return s; // Make sure not to cut a code point in half int i = s.offsetByCodePoints(0, 1); return s.substring(0, i).toUpperCase() + s.substring(i); |
