diff src/eval.c @ 23972:a620df0ebbe5 v8.2.2528

patch 8.2.2528: Vim9: crash when compiling lambda fails Commit: https://github.com/vim/vim/commit/c7dac8534ee7f7a49e9d7a37330397c64455cdd7 Author: Bram Moolenaar <Bram@vim.org> Date: Wed Feb 17 18:49:11 2021 +0100 patch 8.2.2528: Vim9: crash when compiling lambda fails Problem: Vim9: crash when compiling lambda fails. Solution: Bail out after compilation fails. (closes https://github.com/vim/vim/issues/7862)
author Bram Moolenaar <Bram@vim.org>
date Wed, 17 Feb 2021 19:00:04 +0100
parents ba79ceac82ec
children 9fcd71d0db89
line wrap: on
line diff
--- a/src/eval.c
+++ b/src/eval.c
@@ -3428,8 +3428,12 @@ eval7(
 			ufunc_T *ufunc = rettv->vval.v_partial->pt_func;
 
 			// compile it here to get the return type
-			compile_def_function(ufunc,
-						 TRUE, PROFILING(ufunc), NULL);
+			if (compile_def_function(ufunc,
+					 TRUE, PROFILING(ufunc), NULL) == FAIL)
+			{
+			    clear_tv(rettv);
+			    ret = FAIL;
+			}
 		    }
 		}
 		if (ret == NOTDONE)