]> git.rm.cloudns.org Git - xonotic/gmqcc.git/commitdiff
Explicitly allow 'return nil'
authorWolfgang Bumiller <blub@speed.at>
Mon, 31 Dec 2012 10:39:00 +0000 (11:39 +0100)
committerWolfgang Bumiller <blub@speed.at>
Mon, 31 Dec 2012 10:39:00 +0000 (11:39 +0100)
parser.c

index edf4f2a5306273591aa41fe68603679b39b608fe..8fe2c31ffb36518247f6718240194e45c5996230 100644 (file)
--- a/parser.c
+++ b/parser.c
@@ -2534,7 +2534,9 @@ static bool parse_return(parser_t *parser, ast_block *block, ast_expression **ou
         if (!exp)
             return false;
 
-        if (exp->expression.vtype != expected->expression.next->expression.vtype) {
+        if (exp->expression.vtype != TYPE_NIL &&
+            exp->expression.vtype != expected->expression.next->expression.vtype)
+        {
             parseerror(parser, "return with invalid expression");
         }