From 24fb7585c733ed49d01b070384943e51abef4ff7 Mon Sep 17 00:00:00 2001 From: Alex Shinn Date: Thu, 22 Jul 2021 21:43:50 +0900 Subject: [PATCH] set! should guard against exceptions in the var ref lookup (fixes issue #762) --- eval.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eval.c b/eval.c index d3ca1af0..043adeb6 100644 --- a/eval.c +++ b/eval.c @@ -790,7 +790,7 @@ static sexp analyze_set (sexp ctx, sexp x, int depth) { res = sexp_compile_error(ctx, "bad set! syntax", x); } else { ref = analyze_var_ref(ctx, sexp_cadr(x), &varenv); - if (sexp_lambdap(sexp_ref_loc(ref))) + if (sexp_refp(ref) && sexp_lambdap(sexp_ref_loc(ref))) sexp_insert(ctx, sexp_lambda_sv(sexp_ref_loc(ref)), sexp_ref_name(ref)); value = analyze(ctx, sexp_caddr(x), depth, 0); if (sexp_exceptionp(ref)) {