diff options
author | Fabian <f.vioel@googlemail.com> | 2021-10-29 04:13:40 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-10-28 22:13:40 -0400 |
commit | 1dbbaf89bf5d3bcd1edac3af9938c2e2dd18f816 (patch) | |
tree | 1b1f9fd16f4405af5fe82744f42165a085d3a121 /src/nvim/eval/funcs.c | |
parent | bb79e05f811968b398b3bedf95c012c888b96e44 (diff) | |
download | rneovim-1dbbaf89bf5d3bcd1edac3af9938c2e2dd18f816.tar.gz rneovim-1dbbaf89bf5d3bcd1edac3af9938c2e2dd18f816.tar.bz2 rneovim-1dbbaf89bf5d3bcd1edac3af9938c2e2dd18f816.zip |
fix(eval): checking for a non-empty string is too strict (#15987)
Cherry-pick check_for_nonempty_string() from patch vim-8.2.2133 and
apply it on the bases of https://github.com/neovim/neovim/pull/13489
https://github.com/vim/vim/commit/2a9d5d386bea8455b37c1accebc45683ec51d6fb
Diffstat (limited to 'src/nvim/eval/funcs.c')
-rw-r--r-- | src/nvim/eval/funcs.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/nvim/eval/funcs.c b/src/nvim/eval/funcs.c index 1c78e25639..d0f6c178df 100644 --- a/src/nvim/eval/funcs.c +++ b/src/nvim/eval/funcs.c @@ -2201,7 +2201,7 @@ static void f_win_execute(typval_T *argvars, typval_T *rettv, FunPtr fptr) /// "exepath()" function static void f_exepath(typval_T *argvars, typval_T *rettv, FunPtr fptr) { - if (tv_check_for_string(&argvars[0]) == FAIL) { + if (tv_check_for_nonempty_string(&argvars[0]) == FAIL) { return; } @@ -2661,9 +2661,9 @@ static void f_fnamemodify(typval_T *argvars, typval_T *rettv, FunPtr fptr) char buf[NUMBUFLEN]; const char *fname = tv_get_string_chk(&argvars[0]); const char *const mods = tv_get_string_buf_chk(&argvars[1], buf); - if (fname == NULL || mods == NULL) { + if (fname == NULL) { fname = NULL; - } else { + } else if (mods != NULL && *mods != NUL) { len = strlen(fname); size_t usedlen = 0; if (*mods != NUL) { |