File browser crash fix.
BUG=3650
TEST=none
Review URL: http://codereview.chromium.org/2343002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@48505 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/chrome/browser/dom_ui/filebrowse_ui.cc b/chrome/browser/dom_ui/filebrowse_ui.cc
index dd05315..1be3402 100644
--- a/chrome/browser/dom_ui/filebrowse_ui.cc
+++ b/chrome/browser/dom_ui/filebrowse_ui.cc
@@ -1075,8 +1075,11 @@
for (BrowserList::const_iterator it = BrowserList::begin();
it != BrowserList::end(); ++it) {
if ((*it)->type() == Browser::TYPE_POPUP) {
- const GURL& url =
- (*it)->GetTabContentsAt((*it)->selected_index())->GetURL();
+ TabContents* tab_contents = (*it)->GetSelectedTabContents();
+ DCHECK(tab_contents);
+ if (!tab_contents)
+ continue;
+ const GURL& url = tab_contents->GetURL();
if (url.SchemeIs(chrome::kChromeUIScheme) &&
url.host() == chrome::kChromeUIFileBrowseHost &&