If-protect on_true and on_false in ast_ifthen since they can be NULL (contrary to ast_ternary where they can't)

This commit is contained in:
Wolfgang (Blub) Bumiller 2012-05-03 21:56:05 +02:00
parent bbcd3f12de
commit 3e974a1a24

6
ast.c
View file

@ -238,8 +238,10 @@ ast_ifthen* ast_ifthen_new(lex_ctx ctx, ast_expression *cond, ast_expression *on
void ast_ifthen_delete(ast_ifthen *self)
{
ast_unref(self->cond);
ast_unref(self->on_true);
ast_unref(self->on_false);
if (self->on_true)
ast_unref(self->on_true);
if (self->on_flase)
ast_unref(self->on_false);
ast_expression_delete((ast_expression*)self);
mem_d(self);
}