patch 8.2.0159: non-materialized range() list causes problems
Problem: Non-materialized range() list causes problems. (Fujiwara Takuya)
Solution: Materialize the list where needed.
diff --git a/src/userfunc.c b/src/userfunc.c
index ce776ee..1878eab 100644
--- a/src/userfunc.c
+++ b/src/userfunc.c
@@ -1600,13 +1600,14 @@
dict_T *selfdict,
typval_T *rettv)
{
+ list_T *l = args->vval.v_list;
listitem_T *item;
typval_T argv[MAX_FUNC_ARGS + 1];
int argc = 0;
int r = 0;
- for (item = args->vval.v_list->lv_first; item != NULL;
- item = item->li_next)
+ range_list_materialize(l);
+ for (item = l->lv_first; item != NULL; item = item->li_next)
{
if (argc == MAX_FUNC_ARGS - (partial == NULL ? 0 : partial->pt_argc))
{