diff --git a/src/thingdef/thingdef_exp.h b/src/thingdef/thingdef_exp.h index b692be4ad..e56215b0f 100644 --- a/src/thingdef/thingdef_exp.h +++ b/src/thingdef/thingdef_exp.h @@ -997,6 +997,25 @@ public: void SetFunction(VMScriptFunction *func) { MyFunction = func; } }; +//========================================================================== +// +// +// +//========================================================================== + +class FxNop : public FxExpression +{ +public: + FxNop(const FScriptPosition &p) + : FxExpression(p) + { + isresolved = true; + } + ExpEmit Emit(VMFunctionBuilder *build) + { + return ExpEmit(); + } +}; FxExpression *ParseExpression (FScanner &sc, PClassActor *cls, bool mustresolve = false); diff --git a/src/thingdef/thingdef_expression.cpp b/src/thingdef/thingdef_expression.cpp index 1b570c62e..d2ee090e6 100644 --- a/src/thingdef/thingdef_expression.cpp +++ b/src/thingdef/thingdef_expression.cpp @@ -3648,6 +3648,7 @@ FxExpression *FxIfStatement::Resolve(FCompileContext &ctx) FxExpression *e = result ? WhenTrue : WhenFalse; delete (result ? WhenFalse : WhenTrue); WhenTrue = WhenFalse = NULL; + if (e == NULL) e = new FxNop(ScriptPosition); // create a dummy if this statement gets completely removed by optimizing out the constant parts. delete this; return e; }