fix crash

This commit is contained in:
Helium314 2023-08-18 07:58:12 +02:00 committed by GitHub
parent 579fdb81d5
commit a0c53d8f92
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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);