PRUint32 cnt; nsresult rv = mDomSelection->mRangeArray->Count(&cnt); if (NS_FAILED(rv)) return rv; if (mIndex >=0 && mIndex < (PRInt32)cnt){ *aItem = mDomSelection->mRangeArray->ElementAt(mIndex); return NS_OK;
if (mIndex < 0 || mIndex >= mDomSelection->mRangeArray.Count()) { return NS_ERROR_FAILURE;
nsSelectionIterator::CurrentItem(nsISupports **aItem){  if (!aItem)    return NS_ERROR_NULL_POINTER;  PRUint32 cnt;  nsresult rv = mDomSelection->mRangeArray->Count(&cnt);  if (NS_FAILED(rv)) return rv;  if (mIndex >=0 && mIndex < (PRInt32)cnt){    *aItem = mDomSelection->mRangeArray->ElementAt(mIndex);    return NS_OK;  }  return NS_ERROR_FAILURE;}