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(
3292
3292
if (!skip)
3293
3293
{
3294
3294
l = tv.vval.v_list;
3295
- if (tv.v_type != VAR_LIST || l == NULL )
3295
+ if (tv.v_type != VAR_LIST)
3296
3296
{
3297
3297
EMSG(_(e_listreq));
3298
3298
clear_tv(&tv);
3299
3299
}
3300
+ else if (l == NULL)
3301
+ {
3302
+ /* a null list is like an empty list: do nothing */
3303
+ clear_tv(&tv);
3304
+ }
3300
3305
else
3301
3306
{
3302
3307
/* 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()
83
83
call add (x , ' foo' )
84
84
call assert_equal ([' foo' ], y )
85
85
endfunc
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[]) =
753
753
754
754
static int included_patches [] =
755
755
{ /* Add new patch number below this line */
756
+ /**/
757
+ 1816 ,
756
758
/**/
757
759
1815 ,
758
760
/**/
You can’t perform that action at this time.
0 commit comments