diff src/vim9compile.c @ 22276:753452747ae5 v8.2.1687

patch 8.2.1687: Vim9: out of bounds error Commit: https://github.com/vim/vim/commit/9b123d859053ad1fb91d38334726b9f24da39930 Author: Bram Moolenaar <Bram@vim.org> Date: Mon Sep 14 22:39:11 2020 +0200 patch 8.2.1687: Vim9: out of bounds error Problem: Vim9: out of bounds error. Solution: Check that cmdidx is not negative.
author Bram Moolenaar <Bram@vim.org>
date Mon, 14 Sep 2020 22:45:03 +0200
parents 1634ca41e4d3
children 6b385c2b9ff5
line wrap: on
line diff
--- a/src/vim9compile.c
+++ b/src/vim9compile.c
@@ -6903,7 +6903,8 @@ compile_def_function(ufunc_T *ufunc, int
 	if (ea.cmdidx != CMD_SIZE
 			    && ea.cmdidx != CMD_write && ea.cmdidx != CMD_read)
 	{
-	    ea.argt = excmd_get_argt(ea.cmdidx);
+	    if (ea.cmdidx >= 0)
+		ea.argt = excmd_get_argt(ea.cmdidx);
 	    if ((ea.argt & EX_BANG) && *p == '!')
 	    {
 		ea.forceit = TRUE;