diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/nvim/undo.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/nvim/undo.c b/src/nvim/undo.c index 695cf81f73..e27304f04c 100644 --- a/src/nvim/undo.c +++ b/src/nvim/undo.c @@ -3171,11 +3171,14 @@ void f_undofile(typval_T *argvars, typval_T *rettv, EvalFuncData fptr) /// "undotree(expr)" function void f_undotree(typval_T *argvars, typval_T *rettv, EvalFuncData fptr) { - typval_T *const tv = &argvars[0]; - buf_T *const buf = tv->v_type == VAR_UNKNOWN ? curbuf : tv_get_buf_from_arg(tv); - tv_dict_alloc_ret(rettv); + typval_T *const tv = &argvars[0]; + buf_T *const buf = tv->v_type == VAR_UNKNOWN ? curbuf : get_buf_arg(tv); + if (buf == NULL) { + return; + } + dict_T *dict = rettv->vval.v_dict; tv_dict_add_nr(dict, S_LEN("synced"), (varnumber_T)buf->b_u_synced); |