diff src/vim9execute.c @ 23074:cd885eb0e50c v8.2.2083

patch 8.2.2083: Vim9: crash when using ":silent!" and getting member fails Commit: https://github.com/vim/vim/commit/af0df47a7671a39f2cde950587ba48800188bfb9 Author: Bram Moolenaar <Bram@vim.org> Date: Wed Dec 2 20:51:22 2020 +0100 patch 8.2.2083: Vim9: crash when using ":silent!" and getting member fails Problem: Vim9: crash when using ":silent!" and getting member fails. Solution: Jump to on_fatal_error. (closes https://github.com/vim/vim/issues/7412)
author Bram Moolenaar <Bram@vim.org>
date Wed, 02 Dec 2020 21:00:04 +0100
parents 1fa84623fc68
children bdafc132a4a1
line wrap: on
line diff
--- a/src/vim9execute.c
+++ b/src/vim9execute.c
@@ -2669,12 +2669,12 @@ call_def_function(
 		    {
 			SOURCING_LNUM = iptr->isn_lnum;
 			semsg(_(e_dictkey), key);
-			goto on_error;
+			goto on_fatal_error;
 		    }
 		    clear_tv(tv);
 		    --ectx.ec_stack.ga_len;
-		    // Clear the dict after getting the item, to avoid that it
-		    // make the item invalid.
+		    // Clear the dict only after getting the item, to avoid
+		    // that it makes the item invalid.
 		    tv = STACK_TV_BOT(-1);
 		    temp_tv = *tv;
 		    copy_tv(&di->di_tv, tv);
@@ -2997,10 +2997,12 @@ func_return:
 	continue;
 
 on_error:
+	// Jump here for an error that does not require aborting execution.
 	// If "emsg_silent" is set then ignore the error.
 	if (did_emsg_cumul + did_emsg == did_emsg_before && emsg_silent)
 	    continue;
-
+on_fatal_error:
+	// Jump here for an error that messes up the stack.
 	// If we are not inside a try-catch started here, abort execution.
 	if (trylevel <= trylevel_at_start)
 	    goto failed;