From 647fd53a1582385c1f5b618dbba96d583eeba260 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sun, 6 Nov 2016 14:14:54 +0100 Subject: [PATCH] - fixed: An 'if' statement with only one branch may never considered to be always returning. --- src/scripting/codegeneration/codegen.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/scripting/codegeneration/codegen.cpp b/src/scripting/codegeneration/codegen.cpp index 58f73a891..61b23cc15 100644 --- a/src/scripting/codegeneration/codegen.cpp +++ b/src/scripting/codegeneration/codegen.cpp @@ -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(); } //==========================================================================