From 9a9c90a5043202630bd1046feeecdfc2ae6bf909 Mon Sep 17 00:00:00 2001 From: "alexey.lysiuk" Date: Wed, 31 Jan 2018 18:40:15 +0200 Subject: [PATCH] Fixed crash on exit caused by undefined class Referenced but undefined optional class does not abort loading with fatal error For example, incorrect MorphProjectile's PlayerClass or MonsterClass caused crash during shutdown --- src/dobjtype.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/dobjtype.cpp b/src/dobjtype.cpp index 5f109e418..275c3814e 100644 --- a/src/dobjtype.cpp +++ b/src/dobjtype.cpp @@ -280,7 +280,7 @@ void PClass::StaticShutdown () // This must be done in two steps because the native classes are not ordered by inheritance, // so all meta data must be gone before deleting the actual class objects. - for (auto cls : AllClasses) cls->DestroyMeta(cls->Meta); + for (auto cls : AllClasses) if (cls->Meta != nullptr) cls->DestroyMeta(cls->Meta); for (auto cls : AllClasses) delete cls; // Unless something went wrong, anything left here should be class and type objects only, which do not own any scripts. bShutdown = true;