fix for #19117, crash. add check before dereferencing null.

This commit is contained in:
sspitzer%netscape.com 1999-11-17 23:05:29 +00:00
Родитель 7582dd007e
Коммит e69a8417da
1 изменённых файлов: 3 добавлений и 1 удалений

Просмотреть файл

@ -2620,9 +2620,11 @@ GlobalWindowImpl::GetBrowserWindowInterface(
NS_ENSURE_TRUE(aWebShell, NS_ERROR_UNEXPECTED);
nsCOMPtr<nsIWebShellContainer> topLevelWindow;
// fix me! not returning NS_ERROR_FAILURE if topLevelWindow is null.
NS_ENSURE_SUCCESS(aWebShell->GetTopLevelWindow(
getter_AddRefs(topLevelWindow)), NS_ERROR_FAILURE);
if (!topLevelWindow) return NS_ERROR_FAILURE;
return topLevelWindow->QueryInterface(NS_GET_IID(nsIBrowserWindow), (void**)&aBrowser);
}