diff --git a/src/common/scripting/backend/codegen.cpp b/src/common/scripting/backend/codegen.cpp index 6a551f1c61..17e1483358 100644 --- a/src/common/scripting/backend/codegen.cpp +++ b/src/common/scripting/backend/codegen.cpp @@ -9823,6 +9823,8 @@ FxExpression *FxIfStatement::Resolve(FCompileContext &ctx) { CHECKRESOLVED(); + SAFE_RESOLVE(Condition, ctx); + if (WhenTrue == nullptr && WhenFalse == nullptr) { // We don't do anything either way, so disappear delete this; @@ -9830,8 +9832,6 @@ FxExpression *FxIfStatement::Resolve(FCompileContext &ctx) return new FxNop(ScriptPosition); } - SAFE_RESOLVE(Condition, ctx); - if (Condition->ValueType != TypeBool) { Condition = new FxBoolCast(Condition, false);