summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbshe <bshe@chromium.org>2015-11-18 14:42:45 -0800
committerCommit bot <commit-bot@chromium.org>2015-11-18 22:43:44 +0000
commitb4a8cf7a82ae168ea915d44f5997a7e756eca6c6 (patch)
tree3b849a5d14701061beb30fde8e7a458c427f4fe3
parent893bf6a5ad8efee51a01b2d4fe1b09d4709165be (diff)
downloadchromium_src-b4a8cf7a82ae168ea915d44f5997a7e756eca6c6.zip
chromium_src-b4a8cf7a82ae168ea915d44f5997a7e756eca6c6.tar.gz
chromium_src-b4a8cf7a82ae168ea915d44f5997a7e756eca6c6.tar.bz2
Add Nullity check for instant service
This code path is now also used by Android. And it may return null. So add nullity check to avoid crash. BUG=557285 Review URL: https://codereview.chromium.org/1456053002 Cr-Commit-Position: refs/heads/master@{#360433}
-rw-r--r--chrome/browser/ui/views/location_bar/location_bar_view.cc6
1 files changed, 4 insertions, 2 deletions
diff --git a/chrome/browser/ui/views/location_bar/location_bar_view.cc b/chrome/browser/ui/views/location_bar/location_bar_view.cc
index eb0f264..b8b4ea9 100644
--- a/chrome/browser/ui/views/location_bar/location_bar_view.cc
+++ b/chrome/browser/ui/views/location_bar/location_bar_view.cc
@@ -1241,8 +1241,10 @@ const char* LocationBarView::GetClassName() const {
}
void LocationBarView::OnBoundsChanged(const gfx::Rect& previous_bounds) {
- InstantServiceFactory::GetForProfile(profile())->OnOmniboxStartMarginChanged(
- bounds().x());
+ InstantService* instant_service =
+ InstantServiceFactory::GetForProfile(profile());
+ if (instant_service)
+ instant_service->OnOmniboxStartMarginChanged(bounds().x());
OmniboxPopupView* popup = omnibox_view_->model()->popup_model()->view();
if (popup->IsOpen())