Mercurial > vim
changeset 3499:454646820185 v7.3.512
updated for version 7.3.512
Problem: undofile() returns a useless name when passed an empty string.
Solution: Return an empty string. (Christian Brabandt)
author | Bram Moolenaar <bram@vim.org> |
---|---|
date | Mon, 30 Apr 2012 17:35:48 +0200 |
parents | d36e92c7c98a |
children | 873df55f5314 |
files | src/eval.c src/version.c |
diffstat | 2 files changed, 17 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/src/eval.c +++ b/src/eval.c @@ -18259,11 +18259,21 @@ f_undofile(argvars, rettv) rettv->v_type = VAR_STRING; #ifdef FEAT_PERSISTENT_UNDO { - char_u *ffname = FullName_save(get_tv_string(&argvars[0]), FALSE); - - if (ffname != NULL) - rettv->vval.v_string = u_get_undo_file_name(ffname, FALSE); - vim_free(ffname); + char_u *fname = get_tv_string(&argvars[0]); + + if (*fname == NUL) + { + /* If there is no file name there will be no undo file. */ + rettv->vval.v_string = NULL; + } + else + { + char_u *ffname = FullName_save(fname, FALSE); + + if (ffname != NULL) + rettv->vval.v_string = u_get_undo_file_name(ffname, FALSE); + vim_free(ffname); + } } #else rettv->vval.v_string = NULL;