From 4770dc2dfbeaf8749589c4feedc104f26e5aaf6b Mon Sep 17 00:00:00 2001 From: Randy Heit Date: Fri, 19 Feb 2016 16:38:30 -0600 Subject: [PATCH] Fix improper detection of if statements returning --- src/thingdef/thingdef_states.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/thingdef/thingdef_states.cpp b/src/thingdef/thingdef_states.cpp index 49febd06e1..f90b34c47f 100644 --- a/src/thingdef/thingdef_states.cpp +++ b/src/thingdef/thingdef_states.cpp @@ -372,7 +372,7 @@ void AddImplicitReturn(FxSequence *code, const PPrototype *proto, FScanner &sc) else { // Something was returned earlier in the sequence. Make it an error // instead of adding an implicit one. - sc.ScriptError("Action list must end with a return statement"); + sc.ScriptError("Action list must return a value"); } } @@ -487,8 +487,9 @@ FxExpression *ParseActions(FScanner &sc, FState state, FString statestring, Bagg proto = ReturnCheck(proto, true_proto, sc); proto = ReturnCheck(proto, false_proto, sc); // If one side does not end with a return, we don't consider the if statement - // to end with a return. - if (true_ret && (false_proto == NULL || false_ret)) + // to end with a return. If the else case is missing, it can never be considered + // as ending with a return. + if (true_ret && false_ret) { lastwasret = true; }