Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1353)

Unified Diff: chrome/browser/jsmessage_box_handler_win.cc

Issue 56205: NULL check web_contents_ to prevent a crash. (Closed)
Patch Set: Created 11 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/jsmessage_box_handler_win.cc
diff --git a/chrome/browser/jsmessage_box_handler_win.cc b/chrome/browser/jsmessage_box_handler_win.cc
index 847f7cfd4909b6a1f85258a68b9f1080a615b371..5184dd6ccc4895bc7fb315e0a887a5801795481b 100644
--- a/chrome/browser/jsmessage_box_handler_win.cc
+++ b/chrome/browser/jsmessage_box_handler_win.cc
@@ -84,7 +84,7 @@ int JavascriptMessageBoxHandler::GetDialogButtons() const {
}
std::wstring JavascriptMessageBoxHandler::GetWindowTitle() const {
- if (!frame_url_.has_host())
+ if (!frame_url_.has_host() || !web_contents_)
return l10n_util::GetString(IDS_JAVASCRIPT_MESSAGEBOX_DEFAULT_TITLE);
// We really only want the scheme, hostname, and port.
@@ -189,10 +189,11 @@ views::View* JavascriptMessageBoxHandler::GetInitiallyFocusedView() {
void JavascriptMessageBoxHandler::Observe(NotificationType type,
const NotificationSource& source,
const NotificationDetails& details) {
- bool web_contents_gone = false;
if (!web_contents_)
return;
+ bool web_contents_gone = false;
+
if (type == NotificationType::NAV_ENTRY_COMMITTED &&
Source<NavigationController>(source).ptr() == web_contents_->controller())
web_contents_gone = true;
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698