diff options
author | Jan Edmund Lazo <jan.lazo@mail.utoronto.ca> | 2020-12-13 16:35:56 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-12-13 16:35:56 -0500 |
commit | 0285fae5ec06779654d9c7dd1577bd0d6fe73c4c (patch) | |
tree | 66fe4766782e43f6033d4e04e1ef6ab13fed8a0c | |
parent | 9c56d8e5f792cf770ebe88d9488549b4106b06a9 (diff) | |
parent | cb579bbaed9151c9958ed847d42d796438fe1120 (diff) | |
download | rneovim-0285fae5ec06779654d9c7dd1577bd0d6fe73c4c.tar.gz rneovim-0285fae5ec06779654d9c7dd1577bd0d6fe73c4c.tar.bz2 rneovim-0285fae5ec06779654d9c7dd1577bd0d6fe73c4c.zip |
Merge pull request #13526 from janlazo/vim-8.1.0839
vim-patch:8.1.{839,1630,2382},8.2.{669,739,1911,2136,2140}
-rw-r--r-- | src/nvim/eval/funcs.c | 8 | ||||
-rw-r--r-- | src/nvim/eval/typval.h | 2 |
2 files changed, 6 insertions, 4 deletions
diff --git a/src/nvim/eval/funcs.c b/src/nvim/eval/funcs.c index b56034b92d..89d9a85775 100644 --- a/src/nvim/eval/funcs.c +++ b/src/nvim/eval/funcs.c @@ -2463,7 +2463,7 @@ static void f_fnameescape(typval_T *argvars, typval_T *rettv, FunPtr fptr) static void f_fnamemodify(typval_T *argvars, typval_T *rettv, FunPtr fptr) { char_u *fbuf = NULL; - size_t len; + size_t len = 0; char buf[NUMBUFLEN]; const char *fname = tv_get_string_chk(&argvars[0]); const char *const mods = tv_get_string_buf_chk(&argvars[1], buf); @@ -2472,8 +2472,10 @@ static void f_fnamemodify(typval_T *argvars, typval_T *rettv, FunPtr fptr) } else { len = strlen(fname); size_t usedlen = 0; - (void)modify_fname((char_u *)mods, false, &usedlen, - (char_u **)&fname, &fbuf, &len); + if (mods != NULL && *mods != NUL) { + (void)modify_fname((char_u *)mods, false, &usedlen, + (char_u **)&fname, &fbuf, &len); + } } rettv->v_type = VAR_STRING; diff --git a/src/nvim/eval/typval.h b/src/nvim/eval/typval.h index 1e3e9bd366..d8ede1e3ba 100644 --- a/src/nvim/eval/typval.h +++ b/src/nvim/eval/typval.h @@ -492,7 +492,7 @@ static inline void tv_list_ref(list_T *const l) static inline void tv_list_set_ret(typval_T *const tv, list_T *const l) REAL_FATTR_ALWAYS_INLINE REAL_FATTR_NONNULL_ARG(1); -/// Set a list as the return value +/// Set a list as the return value. Increments the reference count. /// /// @param[out] tv Object to receive the list /// @param[in,out] l List to pass to the object |