summaryrefslogtreecommitdiff
path: root/eval.c
diff options
context:
space:
mode:
Diffstat (limited to 'eval.c')
-rw-r--r--eval.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/eval.c b/eval.c
index cb4f41a..96a7a2c 100644
--- a/eval.c
+++ b/eval.c
@@ -426,11 +426,12 @@ static void eval_expr(Evaluator *ev, Expression *e, Value *v) {
case EXPR_WHILE: {
Value cond;
WhileExpr *w = &e->while_;
- bool looped_once = false;
while (1) {
- eval_expr(ev, w->cond, &cond);
- if (!val_truthiness(&cond, &w->cond->type))
- break;
+ if (w->cond) {
+ eval_expr(ev, w->cond, &cond);
+ if (!val_truthiness(&cond, &w->cond->type))
+ break;
+ }
eval_block(ev, &w->body, v);
}
} break;