if (NS_SUCCEEDED(aBegin->GetContent(*getter_AddRefs(beginContent)))){
if (NS_SUCCEEDED(aBegin->GetContent(*getter_AddRefs(beginContent))) && beginContent){
compareFrames(nsIFrame *aBegin, nsIFrame *aEnd){  if (!aBegin || !aEnd)    return 0;  if (aBegin == aEnd)    return 0;  nsCOMPtr<nsIContent> beginContent;  if (NS_SUCCEEDED(aBegin->GetContent(*getter_AddRefs(beginContent)))){    nsCOMPtr<nsIDOMNode>beginNode (beginContent);    nsCOMPtr<nsIContent> endContent;    if (NS_SUCCEEDED(aEnd->GetContent(*getter_AddRefs(endContent)))){      nsCOMPtr<nsIDOMNode>endNode (endContent);      PRBool storage;      PRInt32 int1;      PRInt32 int2;      PRInt32 contentOffset1;      PRInt32 contentOffset2;      aBegin->GetSelected(&storage,&int1,&int2,&contentOffset1);      aEnd->GetSelected(&storage,&int1,&int2,&contentOffset2);      return ComparePoints(beginNode, contentOffset1, endNode, contentOffset2);    }  }  return 0;}