summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/java/android/widget/SelectionActionModeHelper.java8
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 =