0
0
mirror of https://github.com/vim/vim.git synced 2025-09-23 03:43:49 -04:00

patch 9.0.0432: crash when using for loop variable in closure

Problem:    Crash when using for loop variable in closure.
Solution:   Check that the variable wasn't deleted. (issue #11094)
This commit is contained in:
Bram Moolenaar
2022-09-09 21:35:36 +01:00
parent 7cf5839287
commit 6de2296e5e
5 changed files with 41 additions and 2 deletions

View File

@@ -1716,6 +1716,12 @@ get_script_svar(scriptref_T *sref, int dfunc_idx)
return NULL;
}
sv = ((svar_T *)si->sn_var_vals.ga_data) + sref->sref_idx;
if (sv->sv_name == NULL)
{
if (dfunc != NULL)
emsg(_(e_script_variable_was_deleted));
return NULL;
}
if (!equal_type(sv->sv_type, sref->sref_type, 0))
{
if (dfunc != NULL)