]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
patch 8.2.2163: crash when discarded exception is the current exception v8.2.2163
authorBram Moolenaar <Bram@vim.org>
Sat, 19 Dec 2020 16:55:54 +0000 (17:55 +0100)
committerBram Moolenaar <Bram@vim.org>
Sat, 19 Dec 2020 16:55:54 +0000 (17:55 +0100)
Problem:    Crash when discarded exception is the current exception.
Solution:   Compare the execption with current_exception. (closes #7499)

src/ex_eval.c
src/version.c

index 37036903159a9fea6e2ce03c250ae044eb108335..2064cfa242b14ffc4e938beb00799dca1cae7a21 100644 (file)
@@ -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
index 5ea062d05b1459ef861969832e3550d0264b291a..8f2c50a9eb417412c36c002854b2a1a5cee830e8 100644 (file)
@@ -750,6 +750,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    2163,
 /**/
     2162,
 /**/