if (result == NS_OK && (nsnull != ref) && ('\0' != *ref)) {
if (result == NS_OK && (nsnull != ref.get()) && ('\0' != *ref)) {
nsHTMLAnchorElement::GetHash(nsAWritableString& aHash){  nsAutoString href;  nsCOMPtr<nsIURI> uri;  nsresult result = NS_OK;  result = GetHref(href);  if (NS_OK == result) {    result = NS_NewURI(getter_AddRefs(uri), href);    if (NS_OK == result) {      nsXPIDLCString ref;      nsCOMPtr<nsIURL> url(do_QueryInterface(uri));      if (url) {        result = url->GetRef(getter_Copies(ref));      }      if (result == NS_OK && (nsnull != ref) && ('\0' != *ref)) {        aHash.Assign(PRUnichar('#'));        aHash.Append(NS_ConvertASCIItoUCS2(ref));      }      else {        aHash.SetLength(0);      }    }  }  return result;}