aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/eval.c
diff options
context:
space:
mode:
authorJames McCoy <jamessan@jamessan.com>2018-01-25 14:09:36 -0500
committerGitHub <noreply@github.com>2018-01-25 14:09:36 -0500
commit83880cced34c1425cf225c435c7ed05eac6fd44c (patch)
tree8fa470dc21c9264fcee9b06d8f07305ac5fccf53 /src/nvim/eval.c
parent8b1f7d8774b235ae4f0dc0fa64d58e3cad9f8283 (diff)
parent3ff92ba1ee54a9400aac143f4d98d356dc6a8321 (diff)
downloadrneovim-83880cced34c1425cf225c435c7ed05eac6fd44c.tar.gz
rneovim-83880cced34c1425cf225c435c7ed05eac6fd44c.tar.bz2
rneovim-83880cced34c1425cf225c435c7ed05eac6fd44c.zip
Merge pull request #6558 from jamessan/tv_as_string-fix
eval: save_tv_as_string: Correctly handle an empty string
Diffstat (limited to 'src/nvim/eval.c')
-rw-r--r--src/nvim/eval.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/nvim/eval.c b/src/nvim/eval.c
index f663d13c55..07a9e9286d 100644
--- a/src/nvim/eval.c
+++ b/src/nvim/eval.c
@@ -17504,7 +17504,8 @@ static char *save_tv_as_string(typval_T *tv, ptrdiff_t *const len, bool endnl)
// print an error.
if (tv->v_type != VAR_LIST && tv->v_type != VAR_NUMBER) {
const char *ret = tv_get_string_chk(tv);
- if (ret && (*len = strlen(ret))) {
+ if (ret) {
+ *len = strlen(ret);
return xmemdupz(ret, (size_t)(*len));
} else {
*len = -1;