Chromium Code Reviews| Index: components/omnibox/browser/omnibox_controller.cc |
| diff --git a/components/omnibox/browser/omnibox_controller.cc b/components/omnibox/browser/omnibox_controller.cc |
| index 9b5b84ae48372d696b2cedca1345e34dde4ccfd6..42c59f10d6aeecb7297c2c9cb44075ebbf8e647d 100644 |
| --- a/components/omnibox/browser/omnibox_controller.cc |
| +++ b/components/omnibox/browser/omnibox_controller.cc |
| @@ -40,7 +40,7 @@ void OmniboxController::StartAutocomplete( |
| } |
| void OmniboxController::OnResultChanged(bool default_match_changed) { |
| - const bool was_open = popup_->IsOpen(); |
| + const bool was_open = popup_ && popup_->IsOpen(); |
|
Peter Kasting
2016/06/08 01:21:34
These changes avoid a segfault when reaching this
|
| if (default_match_changed) { |
| // The default match has changed, we need to let the OmniboxEditModel know |
| // about new inline autocomplete text (blue highlight). |
| @@ -50,15 +50,16 @@ void OmniboxController::OnResultChanged(bool default_match_changed) { |
| omnibox_edit_model_->OnCurrentMatchChanged(); |
| } else { |
| InvalidateCurrentMatch(); |
| - popup_->OnResultChanged(); |
| + if (popup_) |
| + popup_->OnResultChanged(); |
| omnibox_edit_model_->OnPopupDataChanged(base::string16(), nullptr, |
| base::string16(), false); |
| } |
| - } else { |
| + } else if (popup_) { |
| popup_->OnResultChanged(); |
| } |
| - if (!popup_->IsOpen() && was_open) { |
| + if (was_open && !popup_->IsOpen()) { |
| // Accept the temporary text as the user text, because it makes little sense |
| // to have temporary text when the popup is closed. |
| omnibox_edit_model_->AcceptTemporaryTextAsUserText(); |