ICU-6132 Check for memory allocation error in setText(UText).

X-SVN-Rev: 23260
This commit is contained in:
Michael Ow 2008-01-17 18:49:28 +00:00
parent 6c61aa48a8
commit 15b23ccd3f

View file

@ -324,6 +324,12 @@ void RuleBasedBreakIterator::setText(UText *ut, UErrorCode &status) {
static const UChar c = 0;
fDCharIter = new UCharCharacterIterator(&c, 0);
}
// Check for Null pointer
if (fDCharIter == NULL) {
status = U_MEMORY_ALLOCATION_ERROR;
return;
}
if (fCharIter!=fSCharIter && fCharIter!=fDCharIter) {
// existing fCharIter was adopted from the outside. Delete it now.