diff src/filepath.c @ 23175:d7294a6220ac v8.2.2133

patch 8.2.2133: Vim9: checking for a non-empty string is too strict Commit: https://github.com/vim/vim/commit/2a9d5d386bea8455b37c1accebc45683ec51d6fb Author: Bram Moolenaar <Bram@vim.org> Date: Sat Dec 12 18:58:40 2020 +0100 patch 8.2.2133: Vim9: checking for a non-empty string is too strict Problem: Vim9: checking for a non-empty string is too strict. Solution: Check for any string. (closes https://github.com/vim/vim/issues/7447)
author Bram Moolenaar <Bram@vim.org>
date Sat, 12 Dec 2020 19:00:03 +0100
parents 5f08d4a42898
children 5f69af863502
line wrap: on
line diff
--- a/src/filepath.c
+++ b/src/filepath.c
@@ -876,7 +876,7 @@ f_exepath(typval_T *argvars, typval_T *r
 {
     char_u *p = NULL;
 
-    if (in_vim9script() && check_for_string(&argvars[0]) == FAIL)
+    if (in_vim9script() && check_for_nonempty_string(&argvars[0]) == FAIL)
 	return;
     (void)mch_can_exe(tv_get_string(&argvars[0]), &p, TRUE);
     rettv->v_type = VAR_STRING;
@@ -942,7 +942,7 @@ findfilendir(
 
     rettv->vval.v_string = NULL;
     rettv->v_type = VAR_STRING;
-    if (in_vim9script() && check_for_string(&argvars[0]) == FAIL)
+    if (in_vim9script() && check_for_nonempty_string(&argvars[0]) == FAIL)
 	return;
 
 #ifdef FEAT_SEARCHPATH
@@ -1028,9 +1028,9 @@ f_fnamemodify(typval_T *argvars, typval_
 	return;
     fname = tv_get_string_chk(&argvars[0]);
     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 = (int)STRLEN(fname);
 	(void)modify_fname(mods, FALSE, &usedlen, &fname, &fbuf, &len);