nsCOMPtr<nsIContent> currentKid; aParent->ChildAt(aContentIndex, *getter_AddRefs(currentKid)); NS_ASSERTION(currentKid, "Child not found!"); if (currentKid) { GetOptionAt(currentKid, &ind);
PRInt32 children; aParent->ChildCount(children); if (aContentIndex >= children) {   ind = GetOptionIndexAfter(aParent); } else {    nsCOMPtr<nsIContent> currentKid; aParent->ChildAt(aContentIndex, getter_AddRefs(currentKid)); NS_ASSERTION(currentKid, "Child not found!"); if (currentKid) { ind = GetOptionIndexAt(currentKid); } else { ind = -1; }
nsHTMLSelectElement::WillAddOptions(nsIContent* aOptions,                                    nsIContent* aParent,                                    PRInt32 aContentIndex){  PRInt32 level;  GetContentLevel(aParent, &level);  if (level == -1) {    return NS_ERROR_FAILURE;  }  // Get the index where the options will be inserted  PRInt32 ind = -1;  PRInt32 children;  aParent->ChildCount(children);  if (aContentIndex >= children) {    GetOptionAfter(aParent, &ind);  } else {    nsCOMPtr<nsIContent> currentKid;    aParent->ChildAt(aContentIndex, *getter_AddRefs(currentKid));    NS_ASSERTION(currentKid, "Child not found!");    if (currentKid) {      GetOptionAt(currentKid, &ind);    }  }  InsertOptionsIntoList(aOptions, ind, level);  return NS_OK;}