vim-patch:7.4.1816 (#5833)

Problem:    Looping over a null list throws an error.
Solution:   Skip over the for loop.

d8585eded6
This commit is contained in:
lonerover
2016-12-27 11:15:44 +08:00
committed by Justin M. Keyes
parent 4431975210
commit a6b14dbb0b
3 changed files with 12 additions and 2 deletions

View File

@@ -2621,9 +2621,12 @@ void *eval_for_line(char_u *arg, int *errp, char_u **nextcmdp, int skip)
*errp = FALSE;
if (!skip) {
l = tv.vval.v_list;
if (tv.v_type != VAR_LIST || l == NULL) {
if (tv.v_type != VAR_LIST) {
EMSG(_(e_listreq));
clear_tv(&tv);
} else if (l == NULL) {
// a null list is like an empty list: do nothing
clear_tv(&tv);
} else {
/* No need to increment the refcount, it's already set for the
* list being used in "tv". */