mirror of
https://github.com/neovim/neovim.git
synced 2025-10-03 00:18:33 +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);
|
||||
|
@@ -69,6 +69,7 @@ static char *features[] = {
|
||||
|
||||
// clang-format off
|
||||
static int included_patches[] = {
|
||||
1755,
|
||||
1654,
|
||||
1652,
|
||||
1643,
|
||||
|
Reference in New Issue
Block a user