mirror of
https://github.com/Julow/Unexpected-Keyboard.git
synced 2024-11-25 00:33:24 +01:00
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="\"`.
This commit is contained in:
parent
73267d68fb
commit
b319356a08
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user