forked from aniani/vim
patch 7.4.1755
Problem: When using getreg() on a non-existing register a NULL list is returned. (Bjorn Linse) Solution: Allocate an empty list. Add a test.
This commit is contained in:
@@ -6051,7 +6051,7 @@ list_alloc(void)
|
||||
}
|
||||
|
||||
/*
|
||||
* Allocate an empty list for a return value.
|
||||
* Allocate an empty list for a return value, with reference count set.
|
||||
* Returns OK or FAIL.
|
||||
*/
|
||||
int
|
||||
@@ -13173,7 +13173,9 @@ f_getreg(typval_T *argvars, typval_T *rettv)
|
||||
rettv->v_type = VAR_LIST;
|
||||
rettv->vval.v_list = (list_T *)get_reg_contents(regname,
|
||||
(arg2 ? GREG_EXPR_SRC : 0) | GREG_LIST);
|
||||
if (rettv->vval.v_list != NULL)
|
||||
if (rettv->vval.v_list == NULL)
|
||||
rettv_list_alloc(rettv);
|
||||
else
|
||||
++rettv->vval.v_list->lv_refcount;
|
||||
}
|
||||
else
|
||||
|
Reference in New Issue
Block a user