1
0
forked from aniani/vim

patch 8.2.0619: null dict is not handled like an empty dict

Problem:    Null dict is not handled like an empty dict.
Solution:   Fix the code and add tests. (Yegappan Lakshmanan, closes #5968)
This commit is contained in:
Bram Moolenaar
2020-04-23 13:38:02 +02:00
parent db950e4c03
commit ea04a6e8ba
12 changed files with 128 additions and 27 deletions

View File

@@ -977,14 +977,15 @@ dict_equal(
dictitem_T *item2;
int todo;
if (d1 == NULL && d2 == NULL)
return TRUE;
if (d1 == NULL || d2 == NULL)
return FALSE;
if (d1 == d2)
return TRUE;
if (dict_len(d1) != dict_len(d2))
return FALSE;
if (dict_len(d1) == 0)
// empty and NULL dicts are considered equal
return TRUE;
if (d1 == NULL || d2 == NULL)
return FALSE;
todo = (int)d1->dv_hashtab.ht_used;
for (hi = d1->dv_hashtab.ht_array; todo > 0; ++hi)