summaryrefslogtreecommitdiff
path: root/src/vim9compile.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2022-10-11 20:04:09 +0100
committerBram Moolenaar <Bram@vim.org>2022-10-11 20:04:09 +0100
commita275f2cdcc4353e7653a69c7c818422db5da599d (patch)
tree5c14a63a542f0880495c5e77cf243daadb3b03a7 /src/vim9compile.c
parenta9a364872e41932990aba1787af65f67c7e14917 (diff)
downloadvim-git-a275f2cdcc4353e7653a69c7c818422db5da599d.tar.gz
patch 9.0.0724: closure in compiled function gets same variable in blockv9.0.0724
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)
Diffstat (limited to 'src/vim9compile.c')
-rw-r--r--src/vim9compile.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/vim9compile.c b/src/vim9compile.c
index 468c3846d..b3e1b83ea 100644
--- a/src/vim9compile.c
+++ b/src/vim9compile.c
@@ -47,7 +47,8 @@ lookup_local(char_u *name, size_t len, lvar_T *lvar, cctx_T *cctx)
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)