Commit d41ba856 authored by Evan Stade's avatar Evan Stade Committed by Chromium LUCI CQ

Android: fix crash when closing browser during text selection

Bug: 1160320
Change-Id: I49f31f5a6044024d0c36bea0eb4caf8251440210
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2598331
Commit-Queue: Bo <boliu@chromium.org>
Auto-Submit: Evan Stade <estade@chromium.org>
Reviewed-by: default avatarBo <boliu@chromium.org>
Cr-Commit-Position: refs/heads/master@{#840156}
parent fbad1983
...@@ -37,6 +37,7 @@ public class SmartSelectionMetricsLogger implements SelectionMetricsLogger { ...@@ -37,6 +37,7 @@ public class SmartSelectionMetricsLogger implements SelectionMetricsLogger {
private static final String TAG = "SmartSelectionLogger"; private static final String TAG = "SmartSelectionLogger";
private static final boolean DEBUG = false; private static final boolean DEBUG = false;
// May be null if {@link onWindowAndroidChanged()} sets it to null.
private WindowAndroid mWindowAndroid; private WindowAndroid mWindowAndroid;
private TextClassifier mSession; private TextClassifier mSession;
...@@ -64,6 +65,8 @@ public class SmartSelectionMetricsLogger implements SelectionMetricsLogger { ...@@ -64,6 +65,8 @@ public class SmartSelectionMetricsLogger implements SelectionMetricsLogger {
} }
public void logSelectionStarted(String selectionText, int startOffset, boolean editable) { public void logSelectionStarted(String selectionText, int startOffset, boolean editable) {
if (mWindowAndroid == null) return;
Context context = mWindowAndroid.getContext().get(); Context context = mWindowAndroid.getContext().get();
if (context == null) return; if (context == null) return;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment