diff options
| author | Mihai Popa <popam@google.com> | 2018-05-25 09:12:52 -0700 |
|---|---|---|
| committer | android-build-merger <android-build-merger@google.com> | 2018-05-25 09:12:52 -0700 |
| commit | 3b88884d91a2b7217084e8a2103125240daabcd7 (patch) | |
| tree | f5a644ac97b6008edd37b618cab0494a494eda19 /core/java/android | |
| parent | 5116500c9d9a57c18093cc590716949105f85864 (diff) | |
| parent | 1ffdec20b498284190a606d799ab6e77958fdd04 (diff) | |
Merge "Fix monkey crash in smart selection animation" into pi-dev
am: 1ffdec20b4
Change-Id: Idbc82d56568d65542d189c84954c3c3f7cd7aea9
Diffstat (limited to 'core/java/android')
| -rw-r--r-- | core/java/android/widget/SelectionActionModeHelper.java | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/core/java/android/widget/SelectionActionModeHelper.java b/core/java/android/widget/SelectionActionModeHelper.java index d22b1e66b596..6cb0eaa7f47d 100644 --- a/core/java/android/widget/SelectionActionModeHelper.java +++ b/core/java/android/widget/SelectionActionModeHelper.java @@ -285,10 +285,14 @@ public final class SelectionActionModeHelper { final Layout layout = mTextView.getLayout(); final Runnable onAnimationEndCallback = () -> { - if (result.mStart >= 0 && result.mEnd <= getText(mTextView).length() + final SelectionResult startSelectionResult; + if (result != null && result.mStart >= 0 && result.mEnd <= getText(mTextView).length() && result.mStart <= result.mEnd) { - startSelectionActionMode(result); + startSelectionResult = result; + } else { + startSelectionResult = null; } + startSelectionActionMode(startSelectionResult); }; // TODO do not trigger the animation if the change included only non-printable characters final boolean didSelectionChange = |
