mirror of
https://github.com/Julow/Unexpected-Keyboard.git
synced 2025-06-22 10:42:43 +02:00
Fix crash due to empty strings in keys
This commit is contained in:
parent
44d1343b83
commit
ba05b2770e
@ -46,13 +46,15 @@ public final class ComposeKey
|
|||||||
matched. */
|
matched. */
|
||||||
public static KeyValue apply(int prev, String s)
|
public static KeyValue apply(int prev, String s)
|
||||||
{
|
{
|
||||||
|
final int len = s.length();
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
if (len == 0) return null;
|
||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
KeyValue k = apply(prev, s.charAt(i));
|
KeyValue k = apply(prev, s.charAt(i));
|
||||||
i++;
|
i++;
|
||||||
if (k == null) return null;
|
if (k == null) return null;
|
||||||
if (i >= s.length()) return k;
|
if (i >= len) return k;
|
||||||
if (k.getKind() != KeyValue.Kind.Compose_pending)
|
if (k.getKind() != KeyValue.Kind.Compose_pending)
|
||||||
return null; // Found a final state before the end of [s].
|
return null; // Found a final state before the end of [s].
|
||||||
prev = k.getPendingCompose();
|
prev = k.getPendingCompose();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user