summaryrefslogtreecommitdiff
path: root/src/list.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2022-02-03 21:47:34 +0000
committerBram Moolenaar <Bram@vim.org>2022-02-03 21:47:34 +0000
commit7676c158798a7c90f500cab2c12af0d47bad6026 (patch)
tree3bab5a8f010f30e857747dcb5e41f8db7957d9e5 /src/list.c
parent02a977ea5ee733412011a7f259a4efa0ffc95f1a (diff)
downloadvim-git-7676c158798a7c90f500cab2c12af0d47bad6026.tar.gz
patch 8.2.4293: Vim9: when copying a list it gets type list<any>v8.2.4293
Problem: Vim9: when copying a list it gets type list<any> even when the original list did not have a type. Solution: Only set the type when the original list has a type. (closes #9692)
Diffstat (limited to 'src/list.c')
-rw-r--r--src/list.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/list.c b/src/list.c
index 86c16793f..3a6ea9766 100644
--- a/src/list.c
+++ b/src/list.c
@@ -1216,7 +1216,11 @@ list_copy(list_T *orig, int deep, int top, int copyID)
copy = list_alloc();
if (copy != NULL)
{
- copy->lv_type = alloc_type(top || deep ? &t_list_any: orig->lv_type);
+ if (orig->lv_type == NULL)
+ copy->lv_type = NULL;
+ else
+ copy->lv_type = alloc_type(top || deep
+ ? &t_list_any: orig->lv_type);
if (copyID != 0)
{
// Do this before adding the items, because one of the items may