patch 8.1.2412: crash when evaluating expression with error
Problem: Crash when evaluating expression with error. (Dhiraj Mishra)
Solution: Check parsing failed. (closes #5329)
diff --git a/src/eval.c b/src/eval.c
index 178f473..3b563f7 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -2902,7 +2902,7 @@
rettv->v_type = VAR_UNKNOWN;
ret = get_lambda_tv(arg, rettv, evaluate);
- if (ret == NOTDONE)
+ if (ret != OK)
return FAIL;
else if (**arg != '(')
{
diff --git a/src/testdir/test_lambda.vim b/src/testdir/test_lambda.vim
index 7689219..c55de67 100644
--- a/src/testdir/test_lambda.vim
+++ b/src/testdir/test_lambda.vim
@@ -302,3 +302,8 @@
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
diff --git a/src/version.c b/src/version.c
index d4a677c..1d6d323 100644
--- a/src/version.c
+++ b/src/version.c
@@ -743,6 +743,8 @@
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 2412,
+/**/
2411,
/**/
2410,