Skip to content

Commit 3a6c2e9

Browse files
Fabrice Di MeglioAndroid Git Automerger
authored andcommitted
am a200a23: Merge "Bug 5332065: IOOB in case the suggestionSpan has been removed" into ics-factoryrom
* commit 'a200a23af10dfcbbe46d10e868c2eae9f2c794a4': Bug 5332065: IOOB in case the suggestionSpan has been removed
2 parents 994897f + a200a23 commit 3a6c2e9

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

core/java/android/widget/TextView.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9915,13 +9915,16 @@ private void highlightTextDifferences(SuggestionInfo suggestionInfo, int unionSt
99159915

99169916
@Override
99179917
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
9918+
hide();
9919+
99189920
if (view instanceof TextView) {
99199921
TextView textView = (TextView) view;
99209922
Editable editable = (Editable) mText;
99219923

99229924
SuggestionInfo suggestionInfo = mSuggestionInfos[position];
99239925
final int spanStart = editable.getSpanStart(suggestionInfo.suggestionSpan);
99249926
final int spanEnd = editable.getSpanEnd(suggestionInfo.suggestionSpan);
9927+
if (spanStart < 0 || spanEnd < 0) return; // Span has been removed
99259928
final String originalText = mText.subSequence(spanStart, spanEnd).toString();
99269929

99279930
if (suggestionInfo.suggestionIndex < 0) {
@@ -9983,7 +9986,6 @@ public void onItemClick(AdapterView<?> parent, View view, int position, long id)
99839986
Selection.setSelection(editable, spanEnd + lengthDifference);
99849987
}
99859988
}
9986-
hide();
99879989
}
99889990
}
99899991

0 commit comments

Comments
 (0)