Commit 05bd4bbc authored by Jinsuk Kim's avatar Jinsuk Kim Committed by Commit Bot

Android: Fix NPE at ContentViewCoreImpl.onRotationChanged

Avoids calling methods on null object in ContentViewCoreImpl.
onRotationChanged by adding null checks.

Bug: 824156
Change-Id: I5af9eda71b61e06dc0e55f5eb211504d6dd04bd1
Reviewed-on: https://chromium-review.googlesource.com/981333Reviewed-by: default avatarBo <boliu@chromium.org>
Commit-Queue: Jinsuk Kim <jinsukkim@chromium.org>
Cr-Commit-Position: refs/heads/master@{#546028}
parent 394201c7
...@@ -679,12 +679,14 @@ public class ContentViewCoreImpl implements ContentViewCore, DisplayAndroidObser ...@@ -679,12 +679,14 @@ public class ContentViewCoreImpl implements ContentViewCore, DisplayAndroidObser
// action mode menu items according to the new rotation. So Chrome // action mode menu items according to the new rotation. So Chrome
// has to re-create the action mode. // has to re-create the action mode.
if (mWebContents != null) { if (mWebContents != null) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M SelectionPopupControllerImpl controller = getSelectionPopupController();
&& getSelectionPopupController().isActionModeValid()) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M && controller != null
&& controller.isActionModeValid()) {
hidePopupsAndPreserveSelection(); hidePopupsAndPreserveSelection();
getSelectionPopupController().showActionModeOrClearOnFailure(); controller.showActionModeOrClearOnFailure();
} }
getTextSuggestionHost().hidePopups(); TextSuggestionHost host = getTextSuggestionHost();
if (host != null) host.hidePopups();
} }
int rotationDegrees = 0; int rotationDegrees = 0;
......
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