patch 8.2.1945: crash when passing NULL function to reduce()
Problem: Crash when passing NULL function to reduce().
Solution: Check for NULL pointer and give an error. (Dominique Pellé,
closes #7243)
diff --git a/src/list.c b/src/list.c
index 1da4f3d..beea6fa 100644
--- a/src/list.c
+++ b/src/list.c
@@ -2552,8 +2552,11 @@
}
else
func_name = tv_get_string(&argvars[1]);
- if (*func_name == NUL)
- return; // type error or empty name
+ if (func_name == NULL || *func_name == NUL)
+ {
+ emsg(_(e_missing_function_argument));
+ return;
+ }
vim_memset(&funcexe, 0, sizeof(funcexe));
funcexe.evaluate = TRUE;