if (NS_FAILED(rv) || cnt<=0 || !mRangeArray)
if (NS_FAILED(rv) || cnt <= 0)
nsTypedSelection::CollapseToEnd(){  PRInt32 cnt;  nsresult rv = GetRangeCount(&cnt);  if (NS_FAILED(rv) || cnt<=0 || !mRangeArray)		return NS_ERROR_FAILURE;  // Get the last range	nsCOMPtr<nsISupports>	element = dont_AddRef(mRangeArray->ElementAt(cnt-1));	nsCOMPtr<nsIDOMRange>	lastRange = do_QueryInterface(element);  if (!lastRange)    return NS_ERROR_FAILURE;  nsCOMPtr<nsIDOMNode> parent;  rv = lastRange->GetEndContainer(getter_AddRefs(parent));  if (NS_SUCCEEDED(rv))  {    if (parent)    {      PRInt32 endOffset;      lastRange->GetEndOffset(&endOffset);      rv = Collapse(parent, endOffset);    } else {      // not very likely!      rv = NS_ERROR_FAILURE;    }  }  return rv;}