summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
authorfinnur@chromium.org <finnur@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-08-16 15:20:44 +0000
committerfinnur@chromium.org <finnur@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-08-16 15:20:44 +0000
commitb4a8b247dad598a1a089c3d2dcdcfae7dc7ba46e (patch)
tree9f0f161bccedb45684a20d6a0ea54b02c01fd037 /chrome
parent960369ceecc7425cdee6136ab1dc62813469808d (diff)
downloadchromium_src-b4a8b247dad598a1a089c3d2dcdcfae7dc7ba46e.zip
chromium_src-b4a8b247dad598a1a089c3d2dcdcfae7dc7ba46e.tar.gz
chromium_src-b4a8b247dad598a1a089c3d2dcdcfae7dc7ba46e.tar.bz2
Fix potential crash in Browser::OpenURLAtIndex.
This is a bit of a Coverity nit, but if disposition SUPPRESS_OPEN is ever passed in to this function, it will crash because we try to call Focus on a new_contents pointer that is null. I verified this by hard coding the disposition as we open URLs. BUG=17101 TEST=No significant change. Review URL: http://codereview.chromium.org/155773 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@23532 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r--chrome/browser/browser.cc15
1 files changed, 8 insertions, 7 deletions
diff --git a/chrome/browser/browser.cc b/chrome/browser/browser.cc
index 5478464..ad61077 100644
--- a/chrome/browser/browser.cc
+++ b/chrome/browser/browser.cc
@@ -2692,12 +2692,12 @@ void Browser::OpenURLAtIndex(TabContents* source,
if (GetStatusBubble())
GetStatusBubble()->Hide();
- // Update the location bar. This is synchronous. We specfically don't update
- // the load state since the load hasn't started yet and updating it will put
- // it out of sync with the actual state like whether we're displaying a
- // favicon, which controls the throbber. If we updated it here, the throbber
- // will show the default favicon for a split second when navigating away
- // from the new tab page.
+ // Update the location bar. This is synchronous. We specifically don't
+ // update the load state since the load hasn't started yet and updating it
+ // will put it out of sync with the actual state like whether we're
+ // displaying a favicon, which controls the throbber. If we updated it here,
+ // the throbber will show the default favicon for a split second when
+ // navigating away from the new tab page.
ScheduleUIUpdate(current_tab, TabContents::INVALIDATE_URL);
} else if (disposition == OFF_THE_RECORD) {
OpenURLOffTheRecord(profile_, url);
@@ -2707,7 +2707,8 @@ void Browser::OpenURLAtIndex(TabContents* source,
disposition != NEW_BACKGROUND_TAB, index, force_index, instance);
}
- if (disposition != NEW_BACKGROUND_TAB && source_tab_was_frontmost) {
+ if (disposition != NEW_BACKGROUND_TAB && source_tab_was_frontmost &&
+ new_contents) {
// Give the focus to the newly navigated tab, if the source tab was
// front-most.
new_contents->Focus();