summaryrefslogtreecommitdiff
path: root/src/vim9compile.c
diff options
context:
space:
mode:
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)