From a0c53d8f92abe16cdb6467a568c30bec25c19f88 Mon Sep 17 00:00:00 2001 From: Helium314 Date: Fri, 18 Aug 2023 07:58:12 +0200 Subject: [PATCH] fix crash --- .../dslul/openboard/inputmethod/latin/RichInputConnection.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/java/org/dslul/openboard/inputmethod/latin/RichInputConnection.java b/app/src/main/java/org/dslul/openboard/inputmethod/latin/RichInputConnection.java index 35ae14a1f..53dc69766 100644 --- a/app/src/main/java/org/dslul/openboard/inputmethod/latin/RichInputConnection.java +++ b/app/src/main/java/org/dslul/openboard/inputmethod/latin/RichInputConnection.java @@ -731,7 +731,7 @@ public final class RichInputConnection implements PrivateCommandPerformer { // before ends with separator or similar -> check whether text before cursor ends with the same codepoint int lastBeforeLength = Character.charCount(lastBeforeCodePoint); CharSequence codePointBeforeCursor = getTextBeforeCursor(lastBeforeLength, 0); - if (Character.codePointAt(codePointBeforeCursor, 0) != lastBeforeCodePoint) { + if (codePointBeforeCursor.length() != 0 && Character.codePointAt(codePointBeforeCursor, 0) != lastBeforeCodePoint) { // they are different, as is expected from the issue // now check whether they are the same if the last codepoint of before is removed final CharSequence beforeWithoutLast = before.subSequence(0, before.length() - lastBeforeLength);