WebContents* tab = location_bar_->GetWebContents();
if (!tab)
return;
- const NavigationController& controller = tab->GetController();
+
// Important to use GetVisibleEntry to match what's showing in the omnibox.
- NavigationEntry* nav_entry = controller.GetVisibleEntry();
- DCHECK(nav_entry);
+ NavigationEntry* nav_entry = tab->GetController().GetVisibleEntry();
+ // The visible entry can be NULL in the case of window.open("").
+ if (!nav_entry)
+ return;
+
location_bar_->delegate()->ShowWebsiteSettings(
tab, nav_entry->GetURL(), nav_entry->GetSSL());
}