Bug 101429, bad argument to function, fixes assertion and potential crash. r=harishd, sr=hewitt.

git-svn-id: svn://10.0.0.236/trunk@104177 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
heikki%netscape.com
2001-09-29 00:30:03 +00:00
parent bb5f7810bd
commit 21a67525e5

View File

@@ -342,13 +342,17 @@ inLayoutUtils::GetSubDocumentFor(nsIDOMNode* aNode)
nsCOMPtr<nsIPresShell> shell;
doc->GetShellAt(0, getter_AddRefs(shell));
if (shell) {
nsCOMPtr<nsIPresShell> subShell;
shell->GetSubShellFor(content, getter_AddRefs(subShell));
if (!subShell) return nsnull;
nsCOMPtr<nsISupports> supports;
shell->GetSubShellFor(content, getter_AddRefs(supports));
nsCOMPtr<nsIDocShell> docShell = do_QueryInterface(supports);
if (!docShell)
return nsnull;
nsCOMPtr<nsIDocShell> docShell = do_QueryInterface(subShell);
nsCOMPtr<nsIContentViewer> contentViewer;
docShell->GetContentViewer(getter_AddRefs(contentViewer));
if (!contentViewer)
return nsnull;
nsCOMPtr<nsIDOMDocument> domdoc;
contentViewer->GetDOMDocument(getter_AddRefs(domdoc));
return domdoc;