patch 8.2.3470: crash with error in :catch and also in :finally
Problem: Crash with error in :catch and also in :finally.
Solution: Only discard an exception if there is one. (closes #8954)
diff --git a/src/ex_eval.c b/src/ex_eval.c
index 259cf67..503a3ae 100644
--- a/src/ex_eval.c
+++ b/src/ex_eval.c
@@ -2374,7 +2374,8 @@
default:
if (cstack->cs_flags[idx] & CSF_FINALLY)
{
- if (cstack->cs_pending[idx] & CSTP_THROW)
+ if ((cstack->cs_pending[idx] & CSTP_THROW)
+ && cstack->cs_exception[idx] != NULL)
{
// Cancel the pending exception. This is in the
// finally clause, so that the stack of the