mirror of
https://github.com/ZDoom/qzdoom.git
synced 2025-01-18 07:02:03 +00:00
- don't assume that deserializing an actor will result in a valid pointer.
This addresses a very strange crash I encounteded while travelling in a hub, and ended up with a NULL pointer after the 'Serialize' call which means that some code cleared the variable that is currently being deserialized. I was completely unable to find out what caused this because there is so much recursion going on in the deserializer. All actions on the deserialized actor are now being done with a local copy of that variable so that altering the actual one won't have any adverse effects.
This commit is contained in:
parent
e22043a25b
commit
48430d9b1a
1 changed files with 5 additions and 4 deletions
|
@ -1194,6 +1194,7 @@ FArchive &FArchive::ReadObject (DObject* &obj, PClass *wanttype)
|
|||
const PClass *type;
|
||||
BYTE playerNum;
|
||||
DWORD index;
|
||||
DObject *newobj;
|
||||
|
||||
operator<< (objHead);
|
||||
|
||||
|
@ -1255,11 +1256,11 @@ FArchive &FArchive::ReadObject (DObject* &obj, PClass *wanttype)
|
|||
case NEW_CLS_OBJ:
|
||||
type = ReadClass (wanttype);
|
||||
// Printf ("New class: %s (%u)\n", type->Name, m_File->Tell());
|
||||
obj = type->CreateNew ();
|
||||
newobj = obj = type->CreateNew ();
|
||||
MapObject (obj);
|
||||
obj->SerializeUserVars (*this);
|
||||
obj->Serialize (*this);
|
||||
obj->CheckIfSerialized ();
|
||||
newobj->SerializeUserVars (*this);
|
||||
newobj->Serialize (*this);
|
||||
newobj->CheckIfSerialized ();
|
||||
break;
|
||||
|
||||
case NEW_PLYR_OBJ:
|
||||
|
|
Loading…
Reference in a new issue