diff options
author | glen@chromium.org <glen@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-03-04 16:48:17 +0000 |
---|---|---|
committer | glen@chromium.org <glen@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-03-04 16:48:17 +0000 |
commit | 77cfe3b1f8aa49ebc7fb3337788d8d16ca195c33 (patch) | |
tree | 102c899a4695986cf6c539dc5879b3a6c2b54725 /chrome/browser | |
parent | b70817eadc2b61389999e5323f97248689e2d481 (diff) | |
download | chromium_src-77cfe3b1f8aa49ebc7fb3337788d8d16ca195c33.zip chromium_src-77cfe3b1f8aa49ebc7fb3337788d8d16ca195c33.tar.gz chromium_src-77cfe3b1f8aa49ebc7fb3337788d8d16ca195c33.tar.bz2 |
Fix crasher in InitCurrentUI.
Also fix a leak while I'm here.
TBR=brettw
Review URL: http://codereview.chromium.org/40112
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@10891 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser')
-rw-r--r-- | chrome/browser/dom_ui/dom_ui_contents.cc | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/chrome/browser/dom_ui/dom_ui_contents.cc b/chrome/browser/dom_ui/dom_ui_contents.cc index eb0f60b..a60978f 100644 --- a/chrome/browser/dom_ui/dom_ui_contents.cc +++ b/chrome/browser/dom_ui/dom_ui_contents.cc @@ -204,9 +204,9 @@ const string16& DOMUIContents::GetTitle() const { if (controller()->GetActiveEntry() && controller()->GetActiveEntry()->url().host() == NewTabUI::GetBaseURL().host()) { - string16* title = new string16(WideToUTF16Hack( + static string16* newtab_title = new string16(WideToUTF16Hack( l10n_util::GetString(IDS_NEW_TAB_TITLE))); - return *title; + return *newtab_title; } return WebContents::GetTitle(); } @@ -238,8 +238,14 @@ void DOMUIContents::ProcessDOMUIMessage(const std::string& message, } bool DOMUIContents::InitCurrentUI(bool reload) { + if (!controller()->GetActiveEntry()) + return false; + GURL url = controller()->GetActiveEntry()->url(); + if (url.is_empty() || !url.is_valid()) + return false; + if (reload || url != current_url_) { // Shut down our existing DOMUI. delete current_ui_; |