diff --git a/src/scripting/backend/codegen.cpp b/src/scripting/backend/codegen.cpp index c8fcb1f09..d6fc442c6 100644 --- a/src/scripting/backend/codegen.cpp +++ b/src/scripting/backend/codegen.cpp @@ -10291,9 +10291,14 @@ FxWhileLoop::~FxWhileLoop() FxExpression *FxWhileLoop::DoResolve(FCompileContext &ctx) { CHECKRESOLVED(); - SAFE_RESOLVE(Condition, ctx); + SAFE_RESOLVE_OPT(Condition, ctx); SAFE_RESOLVE_OPT(Code, ctx); + if (Condition == nullptr) + { + Condition = new FxConstant(true, ScriptPosition); + } + if (Condition->ValueType != TypeBool) { Condition = new FxBoolCast(Condition);