Don't crash on OOM. b=353997 r+sr=darin

This commit is contained in:
mats.palmgren%bredband.net 2006-09-30 05:15:57 +00:00
Родитель 60a88738bd
Коммит 8239dcb851
2 изменённых файлов: 2 добавлений и 0 удалений

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

@ -456,6 +456,7 @@ void* AtomImpl::operator new ( size_t size, const nsACString& aString ) CPP_THRO
*/
size += aString.Length() * sizeof(char);
AtomImpl* ii = NS_STATIC_CAST(AtomImpl*, ::operator new(size));
NS_ENSURE_TRUE(ii, nsnull);
char* toBegin = &ii->mString[0];
nsACString::const_iterator fromBegin, fromEnd;

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

@ -211,6 +211,7 @@ nsCOMArrayEnumerator::operator new (size_t size, const nsCOMArray_base& aArray)
// do the actual allocation
nsCOMArrayEnumerator * result =
NS_STATIC_CAST(nsCOMArrayEnumerator*, ::operator new(size));
NS_ENSURE_TRUE(result, nsnull);
// now need to copy over the values, and addref each one
// now this might seem like a lot of work, but we're actually just