diff --git a/core/exec.c b/core/exec.c index f7953d9..57a3ed9 100644 --- a/core/exec.c +++ b/core/exec.c @@ -2400,7 +2400,7 @@ static lai_api_error_t lai_exec_parse(int parse_mode, lai_state_t *state) { } // Pop all nested loops/conditions. - for (int i = 0; i < m; i++) { + for (int i = 0; i < (m + 1); i++) { lai_stackitem_t *pop_item = lai_exec_peek_stack_back(state); LAI_ENSURE(pop_item->kind == LAI_COND_STACKITEM || pop_item->kind == LAI_LOOP_STACKITEM);