]> git.xonotic.org Git - xonotic/gmqcc.git/commitdiff
Fix for loops
authorDale Weiler <weilercdale@gmail.com>
Fri, 30 Jan 2015 04:33:59 +0000 (23:33 -0500)
committerDale Weiler <weilercdale@gmail.com>
Fri, 30 Jan 2015 04:33:59 +0000 (23:33 -0500)
parser.c

index 0b7833717c099605211b8f485537f0a3b5dece19..672ce86799044024dfc955d3dfc5aec31d5e4f28 100644 (file)
--- a/parser.c
+++ b/parser.c
@@ -2595,6 +2595,11 @@ static bool parse_for_go(parser_t *parser, ast_block *block, ast_expression **ou
             goto onerr;
         }
 
+        if (!parser_next(parser)) {
+            parseerror(parser, "expected for-loop condition");
+            goto onerr;
+        }
+    } else {
         if (!parser_next(parser)) {
             parseerror(parser, "expected for-loop condition");
             goto onerr;
@@ -2607,7 +2612,6 @@ static bool parse_for_go(parser_t *parser, ast_block *block, ast_expression **ou
         if (!cond)
             goto onerr;
     }
-
     /* move on to incrementor */
     if (parser->tok != ';') {
         parseerror(parser, "expected semicolon after for-loop initializer");