Bug 67900. Unitialized bare pointer with nsCOMPtr, avoiding crash if GetElementResource() fails, and fixing a leak to boot. r=scottip,rjesup; sr=alecf; a=blizzard

This commit is contained in:
waterson%netscape.com 2001-02-08 21:25:13 +00:00
parent 31b6ee0ac8
commit a964382ebd
2 changed files with 4 additions and 4 deletions

View File

@ -1800,8 +1800,8 @@ XULSortServiceImpl::SortTreeChildren(nsIContent *container, sortPtr sortInfo, PR
{
--currentElement;
nsIRDFResource *resource;
gXULUtils->GetElementResource(child, &resource);
nsCOMPtr<nsIRDFResource> resource;
gXULUtils->GetElementResource(child, getter_AddRefs(resource));
contentSortInfo *contentInfo = CreateContentSortInfo(child, resource);
if(contentInfo)
contentSortInfoArray[currentElement] = contentInfo;

View File

@ -1800,8 +1800,8 @@ XULSortServiceImpl::SortTreeChildren(nsIContent *container, sortPtr sortInfo, PR
{
--currentElement;
nsIRDFResource *resource;
gXULUtils->GetElementResource(child, &resource);
nsCOMPtr<nsIRDFResource> resource;
gXULUtils->GetElementResource(child, getter_AddRefs(resource));
contentSortInfo *contentInfo = CreateContentSortInfo(child, resource);
if(contentInfo)
contentSortInfoArray[currentElement] = contentInfo;