bug #49895: checking in a slight enhancement on Patrick Beards patch

This commit is contained in:
scc%mozilla.org 2000-08-31 11:42:43 +00:00
Родитель 8b20a44782
Коммит 3f22a1ad7c
1 изменённых файлов: 11 добавлений и 4 удалений

Просмотреть файл

@ -352,13 +352,20 @@ nsCategoryManager::AddCategoryEntry( const char *aCategoryName,
*_retval = nsXPIDLCString::Copy(*entry);
}
else
status = NS_ERROR_INVALID_ARG;
status = NS_ERROR_INVALID_ARG; // ...stops us from putting the value in
}
// If you didn't say 'replace', and there was already an entry there,
// then we can't put your value in (that's why we set |status|, above),
// or make it persistent (see below)
if ( NS_SUCCEEDED(status) )
{
// If you didn't say 'replace', and there was already an entry there,
// then we can't put your value in, or make it persistent (see below)
{ // it's OK to put a value in
// don't leak the entry we're replacing (if any)
delete entry;
// now put in the new vaentrylue
entry = new LeafNode(aValue);
nsCStringKey entryNameKey(aEntryName);
category->Put(&entryNameKey, entry);