diff options
author | zeertzjq <zeertzjq@outlook.com> | 2022-10-26 19:53:54 +0800 |
---|---|---|
committer | zeertzjq <zeertzjq@outlook.com> | 2022-10-26 20:53:39 +0800 |
commit | ef363ed37cdf5c460cca840aebc825011e0294ee (patch) | |
tree | 89c7ba09fdc61ce8a526a3da9feac1c7324e97b0 /src/nvim/eval/typval.c | |
parent | cfccae95844db21aad773c9a8f8b636f53d6c8c4 (diff) | |
download | rneovim-ef363ed37cdf5c460cca840aebc825011e0294ee.tar.gz rneovim-ef363ed37cdf5c460cca840aebc825011e0294ee.tar.bz2 rneovim-ef363ed37cdf5c460cca840aebc825011e0294ee.zip |
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 vim/vim#5968)
https://github.com/vim/vim/commit/ea04a6e8baff2f27da7cdd54bf70a5525994f76d
Nvim doesn't support modifying NULL list, so comment out a line.
Diffstat (limited to 'src/nvim/eval/typval.c')
-rw-r--r-- | src/nvim/eval/typval.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/nvim/eval/typval.c b/src/nvim/eval/typval.c index a6a8c16a3b..3b513bfafb 100644 --- a/src/nvim/eval/typval.c +++ b/src/nvim/eval/typval.c @@ -2490,10 +2490,14 @@ bool tv_dict_equal(dict_T *const d1, dict_T *const d2, const bool ic, const bool if (d1 == d2) { return true; } - if (d1 == NULL || d2 == NULL) { + if (tv_dict_len(d1) != tv_dict_len(d2)) { return false; } - if (tv_dict_len(d1) != tv_dict_len(d2)) { + if (tv_dict_len(d1) == 0) { + // empty and NULL dicts are considered equal + return true; + } + if (d1 == NULL || d2 == NULL) { return false; } |