mirror of
https://github.com/vim/vim.git
synced 2025-09-26 04:04:07 -04:00
patch 8.2.2504: Vim9: crash when using an argument from a closure
Problem: Vim9: crash when using an argument from a closure. Solution: Check if gen_load_outer is NULL. (closes #7821)
This commit is contained in:
@@ -1669,6 +1669,18 @@ def Test_closure_using_argument()
|
|||||||
|
|
||||||
unlet g:UseArg
|
unlet g:UseArg
|
||||||
unlet g:UseVararg
|
unlet g:UseVararg
|
||||||
|
|
||||||
|
var lines =<< trim END
|
||||||
|
vim9script
|
||||||
|
def Test(Fun: func(number): number): list<number>
|
||||||
|
return map([1, 2, 3], (_, i) => Fun(i))
|
||||||
|
enddef
|
||||||
|
def Inc(nr: number): number
|
||||||
|
return nr + 2
|
||||||
|
enddef
|
||||||
|
assert_equal([3, 4, 5], Test(Inc))
|
||||||
|
END
|
||||||
|
CheckScriptSuccess(lines)
|
||||||
enddef
|
enddef
|
||||||
|
|
||||||
def MakeGetAndAppendRefs()
|
def MakeGetAndAppendRefs()
|
||||||
|
@@ -750,6 +750,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
2504,
|
||||||
/**/
|
/**/
|
||||||
2503,
|
2503,
|
||||||
/**/
|
/**/
|
||||||
|
@@ -261,7 +261,8 @@ arg_exists(
|
|||||||
if (arg_exists(name, len, idxp, type, gen_load_outer, cctx->ctx_outer)
|
if (arg_exists(name, len, idxp, type, gen_load_outer, cctx->ctx_outer)
|
||||||
== OK)
|
== OK)
|
||||||
{
|
{
|
||||||
++*gen_load_outer;
|
if (gen_load_outer != NULL)
|
||||||
|
++*gen_load_outer;
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user