Skip to content

Commit

Permalink
core/exec: Correctly pop loops when CONTINUE_OP is called
Browse files Browse the repository at this point in the history
This fixes an issue where a Continue would not pop the actual loop itself,
which would manifest in weird execution flow.

Fixes #141
  • Loading branch information
ElectrodeYT committed Dec 13, 2023
1 parent a228465 commit 454e659
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion core/exec.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 454e659

Please sign in to comment.