summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
authortc@google.com <tc@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-04-03 21:30:12 +0000
committertc@google.com <tc@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-04-03 21:30:12 +0000
commit1c370c041ab3333d091efdfbbc814853934d574d (patch)
treef7032ad6df0ac6acff8b76b9a97767418220fd0d /chrome
parentdda9db85dfd14a0424d1da962ee2fd88e6de4e8b (diff)
downloadchromium_src-1c370c041ab3333d091efdfbbc814853934d574d.zip
chromium_src-1c370c041ab3333d091efdfbbc814853934d574d.tar.gz
chromium_src-1c370c041ab3333d091efdfbbc814853934d574d.tar.bz2
NULL check web_contents_ to prevent a crash.
In the notification observer, web_contents_ can be set to NULL so check for a NULL web_contents_ in GetWindowTitle. All the other methods check web_contents_ before using it too. BUG=9672 Review URL: http://codereview.chromium.org/56205 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@13113 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r--chrome/browser/jsmessage_box_handler_win.cc5
1 files changed, 3 insertions, 2 deletions
diff --git a/chrome/browser/jsmessage_box_handler_win.cc b/chrome/browser/jsmessage_box_handler_win.cc
index 847f7cf..5184dd6 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;