mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-26 05:51:20 +00:00
- 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.
This commit is contained in:
parent
f06ee10495
commit
ad343892f3
1 changed files with 6 additions and 1 deletions
|
@ -989,6 +989,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++)
|
||||
{
|
||||
|
@ -1060,7 +1065,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();
|
||||
|
||||
|
|
Loading…
Reference in a new issue