- block StaticPointerSubstitution for non-player objects.

The only safe use of this function is to swap out PlayerPawns for morphing or respawning.
This commit is contained in:
Christoph Oelckers 2020-03-16 09:21:37 +01:00 committed by drfrag
parent 2f2cb9c1c5
commit f4995a2005

View file

@ -495,6 +495,9 @@ void DObject::StaticPointerSubstitution (AActor *old, AActor *notOld)
size_t changed = 0;
int i;
// This is only allowed to replace players. For everything else the results are undefined.
if (!old->IsKindOf(NAME_PlayerPawn) || (notOld != nullptr && !notOld->IsKindOf(NAME_PlayerPawn))) return;
// Go through all objects.
i = 0;DObject *last=0;
for (probe = GC::Root; probe != NULL; probe = probe->ObjNext)