fix segfault

So basically, I used i++ on a linked list instead of i->next. As if that
wasn't bad enough on its own, it even managed to somehow still work in the 2
test scenarios I gave it. Regardless, it is now fixed.
This commit is contained in:
r4 2021-12-21 18:38:52 +01:00
parent 9f339ed44d
commit a8be4540b1

View File

@ -395,7 +395,7 @@ static void stmt(State *s, Scope *sc, TokListItem *t) {
/* find beginning of while loop body */ /* find beginning of while loop body */
TokListItem *lcurl; TokListItem *lcurl;
for (TokListItem *i = t;; i++) { for (TokListItem *i = t;; i = i->next) {
if (i == NULL) { if (i == NULL) {
mark_err(&start->tok); mark_err(&start->tok);
set_err("Expected '{' after 'while' loop condition"); set_err("Expected '{' after 'while' loop condition");