For loops may have an empty condition - don't try processing a NULL

This commit is contained in:
Wolfgang Bumiller 2012-12-20 20:23:35 +01:00
parent a985a5cab1
commit 4f9c7861ec

View file

@ -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;
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;