Handle %stacks not being a pair

Not sure when this would happen, but guard against it.
This commit is contained in:
Christopher Baines 2025-05-15 09:25:30 +01:00
parent 8c63ed7b4e
commit 7ba77010ae
4 changed files with 53 additions and 38 deletions

View file

@ -923,15 +923,18 @@ available. Return the resource once PROC has returned."
(lambda ()
(with-exception-handler
(lambda (exn)
(match (fluid-ref %stacks)
((stack-tag . prompt-tag)
(let ((stack (make-stack #t
0 prompt-tag
0 (and prompt-tag 1))))
(let ((stack
(match (fluid-ref %stacks)
((stack-tag . prompt-tag)
(make-stack #t
0 prompt-tag
0 (and prompt-tag 1)))
(_
(make-stack #t)))))
(raise-exception
(make-exception
exn
(make-knots-exception stack)))))))
(make-knots-exception stack)))))
(lambda ()
(proc resource))))
#:unwind? #t))