Bug 132905. Wallpaper to avoid crash when we can't find a match. r=rjc, sr=alecf.

This commit is contained in:
waterson%netscape.com 2002-07-03 16:59:29 +00:00
Родитель 466a754132
Коммит 061139e07f
1 изменённых файлов: 7 добавлений и 4 удалений

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

@ -1360,7 +1360,7 @@ nsXULContentBuilder::CreateTemplateContents(nsIContent* aElement,
nsCOMPtr<nsIRDFResource> resource;
nsCOMPtr<nsIContent> element = aElement;
while (1) {
while (element) {
nsXULContentUtils::GetElementRefResource(element, getter_AddRefs(resource));
if (resource)
break;
@ -1369,15 +1369,18 @@ nsXULContentBuilder::CreateTemplateContents(nsIContent* aElement,
element->GetParent(*getter_AddRefs(parent));
element = parent;
NS_ASSERTION(element != nsnull,
"walked to the root of the content model without finding template root");
}
NS_ASSERTION(element != nsnull, "walked off the top of the content tree");
if (! element)
return NS_ERROR_FAILURE;
nsTemplateMatch* match = nsnull;
mContentSupportMap.Get(element, &match);
NS_ASSERTION(match != nsnull, "no match in the content support map");
if (! match)
return NS_ERROR_FAILURE;
rv = BuildContentFromTemplate(aTemplateElement, aElement, aElement, PR_FALSE, resource, PR_FALSE,
match, aContainer, aNewIndexInContainer);