Fixed code generation of infinite for loop

https://forum.zdoom.org/viewtopic.php?t=62023
This commit is contained in:
alexey.lysiuk 2018-09-14 11:10:49 +03:00 committed by Christoph Oelckers
parent 2d53ad6f10
commit 7d1af25b46

View file

@ -10291,9 +10291,14 @@ FxWhileLoop::~FxWhileLoop()
FxExpression *FxWhileLoop::DoResolve(FCompileContext &ctx) FxExpression *FxWhileLoop::DoResolve(FCompileContext &ctx)
{ {
CHECKRESOLVED(); CHECKRESOLVED();
SAFE_RESOLVE(Condition, ctx); SAFE_RESOLVE_OPT(Condition, ctx);
SAFE_RESOLVE_OPT(Code, ctx); SAFE_RESOLVE_OPT(Code, ctx);
if (Condition == nullptr)
{
Condition = new FxConstant(true, ScriptPosition);
}
if (Condition->ValueType != TypeBool) if (Condition->ValueType != TypeBool)
{ {
Condition = new FxBoolCast(Condition); Condition = new FxBoolCast(Condition);