File tree Expand file tree Collapse file tree 3 files changed +15
-1
lines changed
Expand file tree Collapse file tree 3 files changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -3292,11 +3292,16 @@ eval_for_line(
32923292 if (!skip)
32933293 {
32943294 l = tv.vval.v_list;
3295- if (tv.v_type != VAR_LIST || l == NULL )
3295+ if (tv.v_type != VAR_LIST)
32963296 {
32973297 EMSG(_(e_listreq));
32983298 clear_tv(&tv);
32993299 }
3300+ else if (l == NULL)
3301+ {
3302+ /* a null list is like an empty list: do nothing */
3303+ clear_tv(&tv);
3304+ }
33003305 else
33013306 {
33023307 /* No need to increment the refcount, it's already set for the
Original file line number Diff line number Diff line change @@ -83,3 +83,10 @@ func Test_getreg_empty_list()
8383 call add (x , ' foo' )
8484 call assert_equal ([' foo' ], y )
8585endfunc
86+
87+ func Test_loop_over_null_list ()
88+ let null_list = submatch (1 , 1 )
89+ for i in null_list
90+ call assert_true (0 , ' should not get here' )
91+ endfor
92+ endfunc
Original file line number Diff line number Diff line change @@ -753,6 +753,8 @@ static char *(features[]) =
753753
754754static int included_patches [] =
755755{ /* Add new patch number below this line */
756+ /**/
757+ 1816 ,
756758/**/
757759 1815 ,
758760/**/
You can’t perform that action at this time.
0 commit comments