- fixed: An 'if' statement with only one branch may never considered to be always returning.

This commit is contained in:
Christoph Oelckers 2016-11-06 14:14:54 +01:00
parent 6414fd301b
commit 647fd53a15
1 changed files with 3 additions and 3 deletions

View File

@ -7441,9 +7441,9 @@ ExpEmit FxIfStatement::Emit(VMFunctionBuilder *build)
bool FxIfStatement::CheckReturn()
{
//An if statement returns if both branches return, if present.
return (WhenTrue == nullptr || WhenTrue->CheckReturn()) &&
(WhenFalse == nullptr || WhenFalse->CheckReturn());
//An if statement returns if both branches return. Both branches must be present.
return WhenTrue != nullptr && WhenTrue->CheckReturn() &&
WhenFalse != nullptr && WhenFalse->CheckReturn();
}
//==========================================================================