Added error recovery when invalid foreach statement found

This commit is contained in:
Jim Monte 2019-12-10 15:44:57 -05:00 committed by Holger Vogt
parent 6f8635550a
commit 9f89ab705a
1 changed files with 4 additions and 1 deletions

View File

@ -761,9 +761,12 @@ cp_evloop(char *string)
cend[stackp]->co_foreachvar =
copy(wlist->wl_word);
wlist = wlist->wl_next;
} else {
}
else {
fprintf(stderr,
"Error: missing foreach variable.\n");
wl_free(wlist);
continue;
}
wlist = cp_doglob(wlist);
cend[stackp]->co_text = wl_copy(wlist);