- fixed: When deserializing the object list, the array must be nulled before using it so that a premature abort does not end up working on random data.

(cherry picked from commit ad343892f3)
This commit is contained in:
Christoph Oelckers 2018-05-29 19:00:41 +02:00 committed by drfrag666
parent c656185069
commit 24d0aee2e7

View file

@ -996,6 +996,11 @@ void FSerializer::ReadObjects(bool hubtravel)
{
DThinker::bSerialOverride = true;
r->mDObjects.Resize(ArraySize());
for (auto &p : r->mDObjects)
{
p = nullptr;
}
// First iteration: create all the objects but do nothing with them yet.
for (unsigned i = 0; i < r->mDObjects.Size(); i++)
{
@ -1067,7 +1072,7 @@ void FSerializer::ReadObjects(bool hubtravel)
// nuke all objects we created here.
for (auto obj : r->mDObjects)
{
if (!(obj->ObjectFlags & OF_EuthanizeMe)) obj->Destroy();
if (obj != nullptr && !(obj->ObjectFlags & OF_EuthanizeMe)) obj->Destroy();
}
r->mDObjects.Clear();