comparison src/list.c @ 22608:f140b9036aa5 v8.2.1852

patch 8.2.1852: map() returing zero for NULL list is unexpected Commit: https://github.com/vim/vim/commit/ffdf8adfa8108d4765fdc68abbd2fe49a4292b25 Author: Bram Moolenaar <Bram@vim.org> Date: Thu Oct 15 22:29:17 2020 +0200 patch 8.2.1852: map() returing zero for NULL list is unexpected Problem: map() returing zero for NULL list is unexpected. Solution: Return the empty list. (closes https://github.com/vim/vim/issues/7133)
author Bram Moolenaar <Bram@vim.org>
date Thu, 15 Oct 2020 22:30:04 +0200
parents 47596deedfb5
children 3e4981de5636
comparison
equal deleted inserted replaced
22607:95b74784c037 22608:f140b9036aa5
1959 char_u *arg_errmsg = (char_u *)(map ? N_("map() argument") 1959 char_u *arg_errmsg = (char_u *)(map ? N_("map() argument")
1960 : N_("filter() argument")); 1960 : N_("filter() argument"));
1961 int save_did_emsg; 1961 int save_did_emsg;
1962 int idx = 0; 1962 int idx = 0;
1963 1963
1964 // Always return the first argument, also on failure.
1965 copy_tv(&argvars[0], rettv);
1966
1964 if (argvars[0].v_type == VAR_BLOB) 1967 if (argvars[0].v_type == VAR_BLOB)
1965 { 1968 {
1966 if ((b = argvars[0].vval.v_blob) == NULL) 1969 if ((b = argvars[0].vval.v_blob) == NULL)
1967 return; 1970 return;
1968 } 1971 }
2108 restore_vimvar(VV_KEY, &save_key); 2111 restore_vimvar(VV_KEY, &save_key);
2109 restore_vimvar(VV_VAL, &save_val); 2112 restore_vimvar(VV_VAL, &save_val);
2110 2113
2111 did_emsg |= save_did_emsg; 2114 did_emsg |= save_did_emsg;
2112 } 2115 }
2113
2114 copy_tv(&argvars[0], rettv);
2115 } 2116 }
2116 2117
2117 /* 2118 /*
2118 * "filter()" function 2119 * "filter()" function
2119 */ 2120 */