am a7c725f2: am e96b1c6f: Merge "Fix crash due to reverse selection." into mnc-dev

* commit 'a7c725f2f3e3b7df1923033555a845bfb6a936f9':
  Fix crash due to reverse selection.
This commit is contained in:
Seigo Nonaka
2015-06-29 03:25:19 +00:00
committed by Android Git Automerger

View File

@@ -7577,10 +7577,14 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
}
String getSelectedText() {
if (hasSelection()) {
return String.valueOf(mText.subSequence(getSelectionStart(), getSelectionEnd()));
if (!hasSelection()) {
return null;
}
return null;
final int start = getSelectionStart();
final int end = getSelectionEnd();
return String.valueOf(
start > end ? mText.subSequence(end, start) : mText.subSequence(start, end));
}
/**