Fix Linux crash on nsnull pointer as part of blocker 123572 r=danm a=radha sr=sfraser

This commit is contained in:
locka%iol.ie 2002-02-05 23:26:51 +00:00
parent fea8c2b1e0
commit 527087c717
2 changed files with 11 additions and 9 deletions

View File

@ -1441,18 +1441,20 @@ void nsWebShellWindow::LoadContentAreas() {
// see if we have a webshell with a matching contentAreaID // see if we have a webshell with a matching contentAreaID
nsCOMPtr<nsIDocShellTreeItem> content; nsCOMPtr<nsIDocShellTreeItem> content;
rv = GetContentShellById(contentAreaID.get(), getter_AddRefs(content)); rv = GetContentShellById(contentAreaID.get(), getter_AddRefs(content));
if (NS_SUCCEEDED(rv)) { if (NS_SUCCEEDED(rv) && content) {
urlChar = ToNewCString(contentURL); nsCOMPtr<nsIWebNavigation> webNav(do_QueryInterface(content));
if (urlChar) { if (webNav) {
nsUnescape(urlChar); urlChar = ToNewCString(contentURL);
contentURL.AssignWithConversion(urlChar); if (urlChar) {
nsCOMPtr<nsIWebNavigation> webNav(do_QueryInterface(content)); nsUnescape(urlChar);
webNav->LoadURI(contentURL.get(), contentURL.AssignWithConversion(urlChar);
webNav->LoadURI(contentURL.get(),
nsIWebNavigation::LOAD_FLAGS_NONE, nsIWebNavigation::LOAD_FLAGS_NONE,
nsnull, nsnull,
nsnull, nsnull,
nsnull); nsnull);
nsMemory::Free(urlChar); nsMemory::Free(urlChar);
}
} }
} }
} }

View File

@ -231,7 +231,7 @@ NS_IMETHODIMP nsXULWindow::GetContentShellById(const PRUnichar* aID,
return NS_OK; return NS_OK;
} }
} }
return NS_OK; return NS_ERROR_FAILURE;
} }
NS_IMETHODIMP nsXULWindow::AddChildWindow(nsIXULWindow *aChild) NS_IMETHODIMP nsXULWindow::AddChildWindow(nsIXULWindow *aChild)