mirror of
https://github.com/neovim/neovim.git
synced 2025-09-14 23:38:17 +00:00
eval: let getreg() return valid list for an undefined register
vim-patch:7.4.1755 this prevents a crash when the list is used in setreg() later
This commit is contained in:
@@ -10096,9 +10096,10 @@ static void f_getreg(typval_T *argvars, typval_T *rettv)
|
||||
rettv->v_type = VAR_LIST;
|
||||
rettv->vval.v_list =
|
||||
get_reg_contents(regname, (arg2 ? kGRegExprSrc : 0) | kGRegList);
|
||||
if (rettv->vval.v_list != NULL) {
|
||||
rettv->vval.v_list->lv_refcount++;
|
||||
if (rettv->vval.v_list == NULL) {
|
||||
rettv->vval.v_list = list_alloc();
|
||||
}
|
||||
rettv->vval.v_list->lv_refcount++;
|
||||
} else {
|
||||
rettv->v_type = VAR_STRING;
|
||||
rettv->vval.v_string = get_reg_contents(regname, arg2 ? kGRegExprSrc : 0);
|
||||
|
Reference in New Issue
Block a user