diff src/list.c @ 26737:10d3105030ab v8.2.3897

patch 8.2.3897: Vim9: second argument of map() and filter() not checked Commit: https://github.com/vim/vim/commit/1802405d71da20dff510690bf14f6da085836125 Author: Bram Moolenaar <Bram@vim.org> Date: Sat Dec 25 21:43:28 2021 +0000 patch 8.2.3897: Vim9: second argument of map() and filter() not checked Problem: Vim9: the second argument of map() and filter() is not checked at compile time. Solution: Add more specific type check for the second argument.
author Bram Moolenaar <Bram@vim.org>
date Sat, 25 Dec 2021 22:45:02 +0100
parents 2126feddeda6
children 9cb27a68a01b
line wrap: on
line diff
--- a/src/list.c
+++ b/src/list.c
@@ -2280,7 +2280,7 @@ filter_map_one(
 
 	// filter(): when expr is zero remove the item
 	if (in_vim9script())
-	    *remp = !tv2bool(newtv);
+	    *remp = !tv_get_bool_chk(newtv, &error);
 	else
 	    *remp = (tv_get_number_chk(newtv, &error) == 0);
 	clear_tv(newtv);