Bug 391960, null check document of anchor node, r+sr=bz,a=damon

This commit is contained in:
enndeakin@sympatico.ca 2007-08-19 09:55:18 -07:00
Родитель 13fbbc4d9d
Коммит d976404c53
1 изменённых файлов: 12 добавлений и 10 удалений

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

@ -861,18 +861,20 @@ nsMenuPopupFrame::SetPopupPosition(nsIFrame* aAnchorFrame)
if (!aAnchorFrame) {
if (mAnchorContent) {
nsCOMPtr<nsIDocument> document = mAnchorContent->GetDocument();
nsIPresShell *shell = document->GetPrimaryShell();
if (!shell)
return NS_ERROR_FAILURE;
aAnchorFrame = shell->GetPrimaryFrameFor(mAnchorContent);
}
else {
aAnchorFrame = presContext->PresShell()->FrameManager()->GetRootFrame();
if (document) {
nsIPresShell *shell = document->GetPrimaryShell();
if (!shell)
return NS_ERROR_FAILURE;
aAnchorFrame = shell->GetPrimaryFrameFor(mAnchorContent);
}
}
if (!aAnchorFrame)
return NS_OK;
if (!aAnchorFrame) {
aAnchorFrame = presContext->PresShell()->FrameManager()->GetRootFrame();
if (!aAnchorFrame)
return NS_OK;
}
}
if (aAnchorFrame->GetContent()) {