From ffd464c26c9effda6094b4ff96e27a3f42aa4dae Mon Sep 17 00:00:00 2001 From: "alexey.lysiuk" Date: Thu, 30 May 2019 10:26:06 +0300 Subject: [PATCH] - fixed crash when loading a saved game with unknown class During serialization, when map shutdown because of unknown class stored inside saved game may occur, level member is not assigned yet to already spawned thinkers --- src/p_mobj.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/p_mobj.cpp b/src/p_mobj.cpp index 0b306f9c20..811b3cca21 100644 --- a/src/p_mobj.cpp +++ b/src/p_mobj.cpp @@ -4819,7 +4819,10 @@ void AActor::OnDestroy () // note that this differs from ThingSpawned in that you can actually override OnDestroy to avoid calling the hook. // but you can't really do that without utterly breaking the game, so it's ok. // note: if OnDestroy is ever made optional, E_WorldThingDestroyed should still be called for ANY thing. - Level->localEventManager->WorldThingDestroyed(this); + if (Level != nullptr) + { + Level->localEventManager->WorldThingDestroyed(this); + } DeleteAttachedLights(); ClearRenderSectorList();