# HG changeset patch # User Bram Moolenaar # Date 1335800148 -7200 # Node ID 454646820185cbe13e1f2e4f7533b984d3b07b18 # Parent d36e92c7c98a3444ff55ac1784910c4186d9cb5a updated for version 7.3.512 Problem: undofile() returns a useless name when passed an empty string. Solution: Return an empty string. (Christian Brabandt) diff --git a/src/eval.c b/src/eval.c --- 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; diff --git a/src/version.c b/src/version.c --- a/src/version.c +++ b/src/version.c @@ -715,6 +715,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 512, +/**/ 511, /**/ 510,