if (!mRangeArray) return NS_ERROR_INVALID_ARG;  PRUint32 cnt; nsresult rv = mRangeArray->Count(&cnt); if (NS_FAILED(rv)) return rv; if (aIndex < 0 || ((PRUint32)aIndex) >= cnt)
PRInt32 cnt = mRangeArray.Count(); if (aIndex < 0 || aIndex >= cnt)
nsTypedSelection::GetRangeAt(PRInt32 aIndex, nsIDOMRange** aReturn){	if (!aReturn)		return NS_ERROR_NULL_POINTER;  if (!mRangeArray)		return NS_ERROR_INVALID_ARG;			PRUint32 cnt;  nsresult rv = mRangeArray->Count(&cnt);  if (NS_FAILED(rv)) return rv;	if (aIndex < 0 || ((PRUint32)aIndex) >= cnt)		return NS_ERROR_INVALID_ARG;	// the result of all this is one additional ref on the item, as	// the caller would expect.	//	// ElementAt addrefs once	// do_QueryInterface addrefs once	// when the COMPtr goes out of scope, it releases.	//	nsISupports*	element = mRangeArray->ElementAt((PRUint32)aIndex);	nsCOMPtr<nsIDOMRange>	foundRange = do_QueryInterface(element);	*aReturn = foundRange;		return NS_OK;}