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

Commit 532f3c98 authored by Siyamed Sinir's avatar Siyamed Sinir
Browse files

Fix crash during TextView.onCreateContextMenu

Test: bit CtsWidgetTestCases:TextViewTest

Bug:62450393
Change-Id: I162c28d253ca197eba9c4c148c76179c2880daa5
parent 6cde6875
Loading
Loading
Loading
Loading
+11 −7
Original line number Diff line number Diff line
@@ -2584,15 +2584,19 @@ public class Editor {
        if (offset == -1) {
            return;
        }

        stopTextActionModeWithPreservingSelection();
        if (mTextView.canSelectText()) {
            final boolean isOnSelection = mTextView.hasSelection()
                && offset >= mTextView.getSelectionStart() && offset <= mTextView.getSelectionEnd();
                    && offset >= mTextView.getSelectionStart()
                    && offset <= mTextView.getSelectionEnd();
            if (!isOnSelection) {
                // Right clicked position is not on the selection. Remove the selection and move the
                // cursor to the right clicked position.
                Selection.setSelection((Spannable) mTextView.getText(), offset);
                stopTextActionMode();
            }
        }

        if (shouldOfferToShowSuggestions()) {
            final SuggestionInfo[] suggestionInfoArray =