- fixed: an 'if' that gets completely optimized away by a constant 'false' condition should not make the entire function disappear.

This commit is contained in:
Christoph Oelckers 2016-04-07 20:31:12 +02:00
commit 58002f7f96
2 changed files with 20 additions and 0 deletions

View file

@ -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;
}