diff src/vim9compile.c @ 30779:9d2c4d49b006 v9.0.0724

patch 9.0.0724: closure in compiled function gets same variable in block Commit: https://github.com/vim/vim/commit/a275f2cdcc4353e7653a69c7c818422db5da599d Author: Bram Moolenaar <Bram@vim.org> Date: Tue Oct 11 20:04:09 2022 +0100 patch 9.0.0724: closure in compiled function gets same variable in block Problem: Closure in compiled function gets same variable in block. Solution: At the end of a block to not always reset the variable count. (issue #11094)
author Bram Moolenaar <Bram@vim.org>
date Tue, 11 Oct 2022 21:15:04 +0200
parents 223865a5f0f0
children 90a257beac7a
line wrap: on
line diff
--- a/src/vim9compile.c
+++ b/src/vim9compile.c
@@ -47,7 +47,8 @@ lookup_local(char_u *name, size_t len, l
     for (idx = 0; idx < cctx->ctx_locals.ga_len; ++idx)
     {
 	lvp = ((lvar_T *)cctx->ctx_locals.ga_data) + idx;
-	if (STRNCMP(name, lvp->lv_name, len) == 0
+	if (lvp->lv_name != NULL
+		&& STRNCMP(name, lvp->lv_name, len) == 0
 					       && STRLEN(lvp->lv_name) == len)
 	{
 	    if (lvar != NULL)