Merge "Bug 5332065: IOOB in case the suggestionSpan has been removed" into ics-factoryrom
This commit is contained in:
committed by
Android (Google) Code Review
commit
a200a23af1
@@ -9879,6 +9879,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;
|
||||
@@ -9886,6 +9888,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) {
|
||||
@@ -9947,7 +9950,6 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
|
||||
Selection.setSelection(editable, spanEnd + lengthDifference);
|
||||
}
|
||||
}
|
||||
hide();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user