]> git.rm.cloudns.org Git - xonotic/gmqcc.git/commitdiff
For loops may have an empty condition - don't try processing a NULL
authorWolfgang Bumiller <blub@speed.at>
Thu, 20 Dec 2012 19:23:35 +0000 (20:23 +0100)
committerWolfgang Bumiller <blub@speed.at>
Thu, 20 Dec 2012 19:23:35 +0000 (20:23 +0100)
parser.c

index 5129962c768c216f8a1e16d15e78b4a8e4026d8c..7bf7a0cd89682a4b6fe47e64c97de271a5c1121a 100644 (file)
--- a/parser.c
+++ b/parser.c
@@ -2255,9 +2255,11 @@ static bool parse_for(parser_t *parser, ast_block *block, ast_expression **out)
     if (!parse_statement_or_block(parser, &ontrue))
         goto onerr;
 
-    cond = process_condition(parser, cond, &ifnot);
-    if (!cond)
-        goto onerr;
+    if (cond) {
+        cond = process_condition(parser, cond, &ifnot);
+        if (!cond)
+            goto onerr;
+    }
     aloop = ast_loop_new(ctx, initexpr, cond, ifnot, NULL, false, increment, ontrue);
     *out = (ast_expression*)aloop;