if (!mInit && mTypes) { delete mTypes; mTypes = nsnull; mDone = PR_TRUE; }
DrawSelectionIterator::DrawSelectionIterator(const SelectionDetails *aSelDetails, PRUnichar *aText, 							PRUint32 aTextLength, nsTextFrame::TextStyle &aTextStyle)              :mOldStyle(aTextStyle){    mDetails = aSelDetails;    mCurrentIdx = 0;    mUniStr = aText;    mLength = aTextLength;    mTypes = nsnull;    mInit = PR_FALSE;    if (!aSelDetails)    {      mDone = PR_TRUE;      return;    }    mDone = (PRBool)(mCurrentIdx>=mLength);    if (mDone)      return;    //special case for 1 selection. later    const SelectionDetails *details = aSelDetails;    if (details->mNext)    {      mTypes = new PRUint8[mLength];      if (!mTypes)        return;      memset(mTypes,0,mLength);//initialize to 0      while (details)      {        if ((details->mType & SELECTION_TYPES_WE_CARE_ABOUT ) &&           (details->mStart != details->mEnd))        {          mInit = PR_TRUE;//WE FOUND SOMETHING WE CARE ABOUT          for (int i = details->mStart; i < details->mEnd; i++)          {              if ((PRUint32)i>=mLength)              {                NS_ASSERTION(0,"Selection Details out of range?");                return;//eh              }              mTypes[i]|=details->mType;//add this bit          }        }        if (!mInit && mTypes) //we have details but none that we        {          delete mTypes;          mTypes = nsnull;          mDone = true;        }        details= details->mNext;      }    }    else if (details->mStart == details->mEnd)//no collapsed selections here!    {      mDone = PR_TRUE;      return;    }    mInit = PR_TRUE;}