Skip to content

Commit

Permalink
Fix crash on shift with empty keys
Browse files Browse the repository at this point in the history
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="\"`.
  • Loading branch information
Julow committed Jan 9, 2024
1 parent 73267d6 commit b319356
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions srcs/juloo.keyboard2/Utils.java
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit b319356

Please sign in to comment.