From ef536e7b00bcc2bff470a0d1ea792727c89a0160 Mon Sep 17 00:00:00 2001 From: "alexey.lysiuk" Date: Thu, 10 May 2018 11:47:16 +0300 Subject: [PATCH] - fixed crash in DECORATE parsing The case with forward declared class used as a parent must be handled explicitly actor MyWeapon : Weapon { Weapon.AmmoType "MyBaseAmmo" } actor MyAmmo : MyBaseAmmo { } actor MyBaseAmmo : Ammo { } --- src/scripting/decorate/thingdef_parse.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/scripting/decorate/thingdef_parse.cpp b/src/scripting/decorate/thingdef_parse.cpp index bad24c872..43330d58f 100644 --- a/src/scripting/decorate/thingdef_parse.cpp +++ b/src/scripting/decorate/thingdef_parse.cpp @@ -62,7 +62,14 @@ EXTERN_CVAR(Bool, strictdecorate); PClassActor *DecoDerivedClass(const FScriptPosition &sc, PClassActor *parent, FName typeName) { - if (parent->VMType->mVersion > MakeVersion(2, 0)) + const PClassType *const parentVMType = parent->VMType; + + if (parentVMType == nullptr) + { + // Abort when forward declared class is used as a parent. This edge case cannot be handled gracefully. + sc.Message(MSG_FATAL, "Tried to define class '%s' without definition of parent class '%s'.", typeName.GetChars(), parent->TypeName.GetChars()); + } + else if (parentVMType->mVersion > MakeVersion(2, 0)) { sc.Message(MSG_ERROR, "Parent class %s of %s not accessible to DECORATE", parent->TypeName.GetChars(), typeName.GetChars()); }