From 62c8715ee9be95f9e0f5164dc9b39a04f4d60e8a Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Mon, 31 Jan 2022 08:12:44 +0800 Subject: vim-patch:8.1.2412: crash when evaluating expression with error (#17109) --- src/nvim/eval.c | 2 +- src/nvim/testdir/test_lambda.vim | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/nvim/eval.c b/src/nvim/eval.c index 40fa05da4f..3325628a8e 100644 --- a/src/nvim/eval.c +++ b/src/nvim/eval.c @@ -4402,7 +4402,7 @@ static int eval_lambda(char_u **const arg, typval_T *const rettv, const bool eva rettv->v_type = VAR_UNKNOWN; int ret = get_lambda_tv(arg, rettv, evaluate); - if (ret == NOTDONE) { + if (ret != OK) { return FAIL; } else if (**arg != '(') { if (verbose) { diff --git a/src/nvim/testdir/test_lambda.vim b/src/nvim/testdir/test_lambda.vim index 63bb4ae1ef..72ddbcf6dc 100644 --- a/src/nvim/testdir/test_lambda.vim +++ b/src/nvim/testdir/test_lambda.vim @@ -303,3 +303,8 @@ func Test_lambda_with_index() let Extract = {-> function(List, ['foobar'])()[0]} call assert_equal('foobar', Extract()) endfunc + +func Test_lambda_error() + " This was causing a crash + call assert_fails('ec{@{->{d->()()', 'E15') +endfunc -- cgit