Skip to content

Commit 13656f0

Browse files
committed
patch 8.2.2163: crash when discarded exception is the current exception
Problem: Crash when discarded exception is the current exception. Solution: Compare the execption with current_exception. (closes #7499)
1 parent 03290b8 commit 13656f0

2 files changed

Lines changed: 6 additions & 5 deletions

File tree

src/ex_eval.c

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -606,6 +606,8 @@ discard_exception(except_T *excp, int was_finished)
606606
{
607607
char_u *saved_IObuff;
608608

609+
if (current_exception == excp)
610+
current_exception = NULL;
609611
if (excp == NULL)
610612
{
611613
internal_error("discard_exception()");
@@ -654,10 +656,7 @@ discard_exception(except_T *excp, int was_finished)
654656
discard_current_exception(void)
655657
{
656658
if (current_exception != NULL)
657-
{
658659
discard_exception(current_exception, FALSE);
659-
current_exception = NULL;
660-
}
661660
did_throw = FALSE;
662661
need_rethrow = FALSE;
663662
}
@@ -2284,8 +2283,8 @@ cleanup_conditionals(
22842283
// Cancel the pending exception. This is in the
22852284
// finally clause, so that the stack of the
22862285
// caught exceptions is not involved.
2287-
discard_exception((except_T *)
2288-
cstack->cs_exception[idx],
2286+
discard_exception(
2287+
(except_T *)cstack->cs_exception[idx],
22892288
FALSE);
22902289
}
22912290
else

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -750,6 +750,8 @@ static char *(features[]) =
750750

751751
static int included_patches[] =
752752
{ /* Add new patch number below this line */
753+
/**/
754+
2163,
753755
/**/
754756
2162,
755757
/**/

0 commit comments

Comments
 (0)