if (NS_FAILED(cN->GetParent(*getter_AddRefs(parent))) || !parent)
if (NS_FAILED(cN->GetParent(*getter_AddRefs(parent))))
nsresult nsContentIterator::NextNode(nsCOMPtr<nsIContent> *ioNextNode){  if (!ioNextNode)    return NS_ERROR_NULL_POINTER;      if (mPre)  // if we are a Pre-order iterator, use pre-order  {    nsCOMPtr<nsIContent> cN = *ioNextNode;    nsCOMPtr<nsIContent> cFirstChild;    PRInt32 numChildren;      cN->ChildCount(numChildren);      // if it has children then next node is first child    if (numChildren)    {      if (NS_FAILED(cN->ChildAt(0,*getter_AddRefs(cFirstChild))))        return NS_ERROR_FAILURE;      if (!cFirstChild)        return NS_ERROR_FAILURE;      *ioNextNode = cFirstChild;      return NS_OK;    }      // else next sibling is next    return GetNextSibling(cN, ioNextNode);  }  else  // post-order  {    nsCOMPtr<nsIContent> cN = *ioNextNode;    nsCOMPtr<nsIContent> cSibling;    nsCOMPtr<nsIContent> parent;    PRInt32              indx;      // get next sibling if there is one    if (NS_FAILED(cN->GetParent(*getter_AddRefs(parent))) || !parent)      return NS_ERROR_FAILURE;    if (!parent || NS_FAILED(parent->IndexOf(cN, indx)))    {      // a little noise to catch some iterator usage bugs.      NS_NOTREACHED("nsContentIterator::NextNode() : no parent found");      return NS_ERROR_FAILURE;    }    if (NS_SUCCEEDED(parent->ChildAt(++indx,*getter_AddRefs(cSibling))) && cSibling)    {      // next node is siblings "deep left" child      *ioNextNode = GetDeepFirstChild(cSibling);       return NS_OK;    }      // else it's the parent    *ioNextNode = parent;  }  return NS_OK;}