diff --git a/src/main/config_parser.rl b/src/main/config_parser.rl index fa0bd39..c557555 100644 --- a/src/main/config_parser.rl +++ b/src/main/config_parser.rl @@ -1031,7 +1031,7 @@ /* loop over all actions until we find the last without target_else */ while (TRUE) { - for (cond_and = cond; (uintptr_t)cond->data.condition.target & 0x1; cond_and = cond_and->data.condition.target) { + for (cond_and = cond; (uintptr_t)cond_and->data.condition.target & 0x1; cond_and = cond_and->data.condition.target) { cond_and->data.condition.target = (liAction*)((uintptr_t)cond_and->data.condition.target & (~0x1)); cond_and->data.condition.target->data.condition.target_else = target; } @@ -1064,7 +1064,7 @@ /* loop over all actions until we find the last without target_else */ while (TRUE) { - for (cond_and = cond; (uintptr_t)cond->data.condition.target & 0x1; cond_and = cond_and->data.condition.target) { + for (cond_and = cond; (uintptr_t)cond_and->data.condition.target & 0x1; cond_and = cond_and->data.condition.target) { cond_and->data.condition.target = (liAction*)((uintptr_t)cond_and->data.condition.target & (~0x1)); cond_and->data.condition.target->data.condition.target_else = target; @@ -1089,11 +1089,11 @@ _printf("got condition_chain in line %zd\n", ctx->line); /* loop over all actions looking for 'and' markers and clear them */ - while (cond) { + while (cond && cond->type == ACTION_TCONDITION) { _printf("condition: %p if: %p else: %p\n", (void*)cond, (void*)cond->data.condition.target, (void*)cond->data.condition.target_else); - for (cond_and = cond; (uintptr_t)cond->data.condition.target & 0x1; cond_and = cond_and->data.condition.target) { + for (cond_and = cond; cond_and && (cond_and->type == ACTION_TCONDITION) && (uintptr_t)cond_and->data.condition.target & 0x1; cond_and = cond_and->data.condition.target) { cond_and->data.condition.target = (liAction*)((uintptr_t)cond_and->data.condition.target & (~0x1)); - _printf("condition: if: %p else: %p\n", (void*)cond->data.condition.target, (void*)cond->data.condition.target_else); + _printf("condition_and: %p if: %p else: %p\n", (void*)cond_and, (void*)cond_and->data.condition.target, (void*)cond_and->data.condition.target_else); } if (cond->data.condition.target_else)