Index: chrome/browser/ui/blocked_content/app_modal_dialog_helper.cc |
diff --git a/chrome/browser/ui/blocked_content/app_modal_dialog_helper.cc b/chrome/browser/ui/blocked_content/app_modal_dialog_helper.cc |
index 05b0f921b337ce8ea50b76c848493686d8b99038..fb61052b8c692f54cdb1b177cf110d668f71d1fc 100644 |
--- a/chrome/browser/ui/blocked_content/app_modal_dialog_helper.cc |
+++ b/chrome/browser/ui/blocked_content/app_modal_dialog_helper.cc |
@@ -16,18 +16,20 @@ AppModalDialogHelper::AppModalDialogHelper(content::WebContents* dialog_host) |
// If the WebContents that triggered this dialog is not currently focused, we |
// want to store a potential popup here to restore it after the dialog was |
// closed. |
- chrome::HostDesktopType desktop_type = |
- chrome::GetHostDesktopTypeForNativeView(dialog_host->GetNativeView()); |
- Browser* active_browser = |
- BrowserList::GetInstance(desktop_type)->GetLastActive(); |
- content::WebContents* active_web_contents = |
- active_browser->tab_strip_model()->GetActiveWebContents(); |
- if (active_browser->is_type_popup() && |
- active_web_contents->GetOpener() == dialog_host) { |
- // It's indeed a popup from the dialog opening WebContents. Store it, so |
- // we can focus it later. |
- popup_ = active_web_contents; |
- Observe(popup_); |
+ if (dialog_host) { |
Bernhard Bauer
2014/12/22 13:18:35
Why do you even construct this object if you don't
|
+ chrome::HostDesktopType desktop_type = |
+ chrome::GetHostDesktopTypeForNativeView(dialog_host->GetNativeView()); |
+ Browser* active_browser = |
+ BrowserList::GetInstance(desktop_type)->GetLastActive(); |
+ content::WebContents* active_web_contents = |
+ active_browser->tab_strip_model()->GetActiveWebContents(); |
+ if (active_browser->is_type_popup() && |
+ active_web_contents->GetOpener() == dialog_host) { |
+ // It's indeed a popup from the dialog opening WebContents. Store it, so |
+ // we can focus it later. |
+ popup_ = active_web_contents; |
+ Observe(popup_); |
+ } |
} |
} |