summaryrefslogtreecommitdiffstats
path: root/src/dict.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2021-08-12 19:27:57 +0200
committerBram Moolenaar <Bram@vim.org>2021-08-12 19:27:57 +0200
commitef98257593a0abf1300d0f70358dc45a70a62580 (patch)
treeb54637016b2993dd37b4abda8cc4d8b03673719f /src/dict.c
parentbd77aa92744d79f3ba69aee713739ec17da474f6 (diff)
patch 8.2.3335: Vim9: not enough tests run with Vim9v8.2.3335
Problem: Vim9: not enough tests run with Vim9. Solution: Run a few more tests in Vim9 script and :def function. Fix that items(), keys() and values9) return zero for a NULL dict. Make join() return an empty string for a NULL list. Make sort() return an empty list for a NULL list.
Diffstat (limited to 'src/dict.c')
-rw-r--r--src/dict.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/dict.c b/src/dict.c
index 9ce6dda3d2..dca0b9f929 100644
--- a/src/dict.c
+++ b/src/dict.c
@@ -1209,11 +1209,12 @@ dict_list(typval_T *argvars, typval_T *rettv, int what)
emsg(_(e_dictreq));
return;
}
- if ((d = argvars[0].vval.v_dict) == NULL)
- return;
if (rettv_list_alloc(rettv) == FAIL)
return;
+ if ((d = argvars[0].vval.v_dict) == NULL)
+ // empty dict behaves like an empty dict
+ return;
todo = (int)d->dv_hashtab.ht_used;
for (hi = d->dv_hashtab.ht_array; todo > 0; ++hi)