From 4f9c7861ec178d5250abb78969ee0efc0f3ac34e Mon Sep 17 00:00:00 2001 From: Wolfgang Bumiller Date: Thu, 20 Dec 2012 20:23:35 +0100 Subject: [PATCH] For loops may have an empty condition - don't try processing a NULL --- parser.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/parser.c b/parser.c index 5129962..7bf7a0c 100644 --- 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; -- 2.39.2