diff options
author | zeertzjq <zeertzjq@outlook.com> | 2022-11-23 20:40:46 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-11-23 20:40:46 +0800 |
commit | d25889ab7607918a152bab5ce4d14e54575ec11b (patch) | |
tree | b3524e4aac01680efa2e479af6837c2f7d4f8f4f /src/nvim/eval/typval.c | |
parent | f1b88ced07a5dcc62cd847cade2ed97e23fffbf9 (diff) | |
parent | 27fceca50195957c977b1e718f571fef795ea824 (diff) | |
download | rneovim-d25889ab7607918a152bab5ce4d14e54575ec11b.tar.gz rneovim-d25889ab7607918a152bab5ce4d14e54575ec11b.tar.bz2 rneovim-d25889ab7607918a152bab5ce4d14e54575ec11b.zip |
Merge pull request #21163 from zeertzjq/vim-9.0.0925
vim-patch:9.0.{0925,0926,0927}
Diffstat (limited to 'src/nvim/eval/typval.c')
-rw-r--r-- | src/nvim/eval/typval.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/nvim/eval/typval.c b/src/nvim/eval/typval.c index 47c3551a56..25b2a20bac 100644 --- a/src/nvim/eval/typval.c +++ b/src/nvim/eval/typval.c @@ -2471,11 +2471,13 @@ void tv_dict_extend(dict_T *const d1, dict_T *const d2, const char *const action } if (di1 == NULL) { if (*action == 'm') { - // cheap way to move a dict item from "d2" to "d1" + // Cheap way to move a dict item from "d2" to "d1". + // If dict_add() fails then "d2" won't be empty. dictitem_T *const new_di = di2; - tv_dict_add(d1, new_di); - hash_remove(&d2->dv_hashtab, hi2); - tv_dict_watcher_notify(d1, (const char *)new_di->di_key, &new_di->di_tv, NULL); + if (tv_dict_add(d1, new_di) == OK) { + hash_remove(&d2->dv_hashtab, hi2); + tv_dict_watcher_notify(d1, (const char *)new_di->di_key, &new_di->di_tv, NULL); + } } else { dictitem_T *const new_di = tv_dict_item_copy(di2); if (tv_dict_add(d1, new_di) == FAIL) { |