summaryrefslogtreecommitdiff
path: root/src/ex_eval.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2020-12-19 17:55:54 +0100
committerBram Moolenaar <Bram@vim.org>2020-12-19 17:55:54 +0100
commit13656f02e457fb68cd7e72412fc24ccac02fb06e (patch)
tree1dd0d878cfb3230aab6e52beb6b6e5849816b937 /src/ex_eval.c
parent03290b8444b69c6d7307755770467bc488384e1a (diff)
downloadvim-git-13656f02e457fb68cd7e72412fc24ccac02fb06e.tar.gz
patch 8.2.2163: crash when discarded exception is the current exceptionv8.2.2163
Problem: Crash when discarded exception is the current exception. Solution: Compare the execption with current_exception. (closes #7499)
Diffstat (limited to 'src/ex_eval.c')
-rw-r--r--src/ex_eval.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/ex_eval.c b/src/ex_eval.c
index 370369031..2064cfa24 100644
--- a/src/ex_eval.c
+++ b/src/ex_eval.c
@@ -606,6 +606,8 @@ discard_exception(except_T *excp, int was_finished)
{
char_u *saved_IObuff;
+ if (current_exception == excp)
+ current_exception = NULL;
if (excp == NULL)
{
internal_error("discard_exception()");
@@ -654,10 +656,7 @@ discard_exception(except_T *excp, int was_finished)
discard_current_exception(void)
{
if (current_exception != NULL)
- {
discard_exception(current_exception, FALSE);
- current_exception = NULL;
- }
did_throw = FALSE;
need_rethrow = FALSE;
}
@@ -2284,8 +2283,8 @@ cleanup_conditionals(
// Cancel the pending exception. This is in the
// finally clause, so that the stack of the
// caught exceptions is not involved.
- discard_exception((except_T *)
- cstack->cs_exception[idx],
+ discard_exception(
+ (except_T *)cstack->cs_exception[idx],
FALSE);
}
else