Skip to content

Commit

Permalink
Fixed crash on exit caused by undefined class
Browse files Browse the repository at this point in the history
Referenced but undefined optional class does not abort loading with fatal error
For example, incorrect MorphProjectile's PlayerClass or MonsterClass caused crash during shutdown
  • Loading branch information
alexey-lysiuk committed Jan 31, 2018
1 parent 1608e11 commit 9a9c90a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/dobjtype.cpp
Expand Up @@ -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;
Expand Down

0 comments on commit 9a9c90a

Please sign in to comment.