Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 1127895f authored by Eric Fischer's avatar Eric Fischer
Browse files

Guard against calls to getTextAfterCursor() in text that has no cursor.

Act like the cursor is at 0 in this case instead of crashing.

Bug 2497485

Change-Id: I5ce9b83b323d895e3be75e3133ff2f8e33cc203d
parent b3871fad
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -328,6 +328,11 @@ public class BaseInputConnection implements InputConnection {
            b = tmp;
        }

        // Guard against the case where the cursor has not been positioned yet.
        if (b < 0) {
            b = 0;
        }

        if (b + length > content.length()) {
            length = content.length() - b;
        }