Fix improper detection of if statements returning

This commit is contained in:
Randy Heit 2016-02-19 16:38:30 -06:00
parent 80d49d6bb9
commit 4770dc2dfb

View file

@ -372,7 +372,7 @@ void AddImplicitReturn(FxSequence *code, const PPrototype *proto, FScanner &sc)
else else
{ // Something was returned earlier in the sequence. Make it an error { // Something was returned earlier in the sequence. Make it an error
// instead of adding an implicit one. // 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, true_proto, sc);
proto = ReturnCheck(proto, false_proto, sc); proto = ReturnCheck(proto, false_proto, sc);
// If one side does not end with a return, we don't consider the if statement // If one side does not end with a return, we don't consider the if statement
// to end with a return. // to end with a return. If the else case is missing, it can never be considered
if (true_ret && (false_proto == NULL || false_ret)) // as ending with a return.
if (true_ret && false_ret)
{ {
lastwasret = true; lastwasret = true;
} }