if (!aAnchorElement) return NS_ERROR_NULL_POINTER;
if (!aAnchorElement) goto DELETE_ANCHOR;
nsHTMLEditor::InsertLinkAroundSelection(nsIDOMElement* aAnchorElement){  nsresult res=NS_ERROR_NULL_POINTER;  nsCOMPtr<nsIDOMSelection> selection;  if (!aAnchorElement) return NS_ERROR_NULL_POINTER;   // We must have a real selection  res = GetSelection(getter_AddRefs(selection));  if (!selection)  {    res = NS_ERROR_NULL_POINTER;  }  if (NS_FAILED(res)) return res;  if (!selection) return NS_ERROR_NULL_POINTER;  PRBool isCollapsed;  res = selection->GetIsCollapsed(&isCollapsed);  if (NS_FAILED(res))    isCollapsed = PR_TRUE;    if (isCollapsed)  {    printf("InsertLinkAroundSelection called but there is no selection!!!\n");         res = NS_OK;  } else {    // Be sure we were given an anchor element    nsCOMPtr<nsIDOMHTMLAnchorElement> anchor = do_QueryInterface(aAnchorElement);    if (anchor)    {      nsAutoString href;      res = anchor->GetHref(href);      if (NS_FAILED(res)) return res;      if (href.GetUnicode() && href.Length() > 0)            {        nsAutoEditBatch beginBatching(this);        const nsString attribute("href");        SetInlineProperty(nsIEditProperty::a, &attribute, &href);        //TODO: Enumerate through other properties of the anchor tag        // and set those as well.         // Optimization: Modify SetTextProperty to set all attributes at once?      }    }  }  return res;}