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

Commit 3a6c2e98 authored by Fabrice Di Meglio's avatar Fabrice Di Meglio Committed by Android Git Automerger
Browse files

am a200a23a: Merge "Bug 5332065: IOOB in case the suggestionSpan has been...

am a200a23a: Merge "Bug 5332065: IOOB in case the suggestionSpan has been removed" into ics-factoryrom

* commit 'a200a23a':
  Bug 5332065: IOOB in case the suggestionSpan has been removed
parents 994897f0 a200a23a
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -9915,6 +9915,8 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener

        @Override
        public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            hide();

            if (view instanceof TextView) {
                TextView textView = (TextView) view;
                Editable editable = (Editable) mText;
@@ -9922,6 +9924,7 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
                SuggestionInfo suggestionInfo = mSuggestionInfos[position];
                final int spanStart = editable.getSpanStart(suggestionInfo.suggestionSpan);
                final int spanEnd = editable.getSpanEnd(suggestionInfo.suggestionSpan);
                if (spanStart < 0 || spanEnd < 0) return; // Span has been removed
                final String originalText = mText.subSequence(spanStart, spanEnd).toString();

                if (suggestionInfo.suggestionIndex < 0) {
@@ -9983,7 +9986,6 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
                    Selection.setSelection(editable, spanEnd + lengthDifference);
                }
            }
            hide();
        }
    }