diff options
author | finnur@google.com <finnur@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-08-13 03:11:19 +0000 |
---|---|---|
committer | finnur@google.com <finnur@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-08-13 03:11:19 +0000 |
commit | 608b1eb1811d270ee031a1a734a2b24344d2d8f2 (patch) | |
tree | daa3847edda6c4e536be3cac8afafdc3133469b1 /chrome/browser/browser_commands.cc | |
parent | cd679231a094df52a9f0778b7430fad0f8310e50 (diff) | |
download | chromium_src-608b1eb1811d270ee031a1a734a2b24344d2d8f2.zip chromium_src-608b1eb1811d270ee031a1a734a2b24344d2d8f2.tar.gz chromium_src-608b1eb1811d270ee031a1a734a2b24344d2d8f2.tar.bz2 |
When I added some new tests in automated_ui_tests I flushed out a crash in the IDC handler for ViewSource. If Navigate is not called before ViewSource we get a crash when trying to use the output from GetLastCommittedEntry(). To facilitate automatic testing We should instead just check it for null and only do something if a URL is available to us.
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@779 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/browser_commands.cc')
-rw-r--r-- | chrome/browser/browser_commands.cc | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/chrome/browser/browser_commands.cc b/chrome/browser/browser_commands.cc index 9492c71..e0e14e1 100644 --- a/chrome/browser/browser_commands.cc +++ b/chrome/browser/browser_commands.cc @@ -494,11 +494,12 @@ void Browser::ExecuteCommand(int id) { UserMetrics::RecordAction(L"ViewSource", profile_); TabContents* current_tab = GetSelectedTabContents(); - DCHECK(current_tab->controller()->GetLastCommittedEntry()); - GURL url("view-source:" + - current_tab->controller()->GetLastCommittedEntry()->GetURL().spec()); - - AddTabWithURL(url, PageTransition::LINK, true, NULL); + NavigationEntry* entry = + current_tab->controller()->GetLastCommittedEntry(); + if (entry) { + GURL url("view-source:" + entry->GetURL().spec()); + AddTabWithURL(url, PageTransition::LINK, true, NULL); + } break; } |