aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/eval/executor.c
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2024-07-31 09:53:13 +0800
committerzeertzjq <zeertzjq@outlook.com>2024-07-31 10:49:55 +0800
commit43c137c3d8473ab87b5dad5c4c2414dd1016f663 (patch)
treeaa63cb1df4e9373f1e3519293aabfe6c0155a113 /src/nvim/eval/executor.c
parent403de7ffc752c811d012020412ce1bbd4c61986f (diff)
downloadrneovim-43c137c3d8473ab87b5dad5c4c2414dd1016f663.tar.gz
rneovim-43c137c3d8473ab87b5dad5c4c2414dd1016f663.tar.bz2
rneovim-43c137c3d8473ab87b5dad5c4c2414dd1016f663.zip
vim-patch:9.2.1731: Vim9: cannot use += to append to empty NULL list
Problem: Vim9: cannot use += to append to empty NULL list. Solution: Copy the list instead of extending it. (closes vim/vim#6998) https://github.com/vim/vim/commit/81ed4960482f8baabdd7f95b4d5e39744be88ae7 Co-authored-by: Bram Moolenaar <Bram@vim.org>
Diffstat (limited to 'src/nvim/eval/executor.c')
-rw-r--r--src/nvim/eval/executor.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/nvim/eval/executor.c b/src/nvim/eval/executor.c
index 3255e78d09..4f83eaa173 100644
--- a/src/nvim/eval/executor.c
+++ b/src/nvim/eval/executor.c
@@ -59,8 +59,13 @@ int eexe_mod_op(typval_T *const tv1, const typval_T *const tv2, const char *cons
break;
}
// List += List
- if (tv1->vval.v_list != NULL && tv2->vval.v_list != NULL) {
- tv_list_extend(tv1->vval.v_list, tv2->vval.v_list, NULL);
+ if (tv2->vval.v_list != NULL) {
+ if (tv1->vval.v_list == NULL) {
+ tv1->vval.v_list = tv2->vval.v_list;
+ tv_list_ref(tv1->vval.v_list);
+ } else {
+ tv_list_extend(tv1->vval.v_list, tv2->vval.v_list, NULL);
+ }
}
return OK;
case VAR_NUMBER: