ICU-89 fix MergeCollation double deletion

X-SVN-Rev: 1808
This commit is contained in:
Alan Liu 2000-07-12 15:52:24 +00:00
parent 58c0144374
commit 309dbf336b

View File

@ -393,16 +393,24 @@ void MergeCollation::fixEntry(PatternEntry* newEntry,
oldIndex = patterns->lastIndexOf(newEntry);
}
int32_t lastIndex = -1;
if (oldIndex != -1) {
PatternEntry *p = patterns->orphanAt(oldIndex);
if (lastEntry == p) {
lastEntry = 0; // Prevent double deletion
lastIndex = patterns->size();
}
delete p;
}
if (lastIndex < 0) {
// Find the insertion point for the new entry.
int32_t lastIndex = findLastEntry(lastEntry, excess, success);
lastIndex = findLastEntry(lastEntry, excess, success);
if (U_FAILURE(success)) {
return;
}
}
// Do not change the last entry if the new entry is a expanding character
if (excess.length() != 0) {