diff options
author | ZyX <kp-pav@yandex.ru> | 2016-03-20 20:03:12 +0300 |
---|---|---|
committer | ZyX <kp-pav@yandex.ru> | 2016-04-18 02:48:20 +0300 |
commit | 9af400f97916851ecd86975118faea2a8c68598f (patch) | |
tree | f3615d14e90dc30decade68014c95cf74ca260ea /src | |
parent | af7ff808c73110f04aadaaab72eac6307dae0cc2 (diff) | |
download | rneovim-9af400f97916851ecd86975118faea2a8c68598f.tar.gz rneovim-9af400f97916851ecd86975118faea2a8c68598f.tar.bz2 rneovim-9af400f97916851ecd86975118faea2a8c68598f.zip |
eval: Treat [] and [""] as any other empty string
Diffstat (limited to 'src')
-rw-r--r-- | src/nvim/eval.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/nvim/eval.c b/src/nvim/eval.c index bec234bb22..e23702ac16 100644 --- a/src/nvim/eval.c +++ b/src/nvim/eval.c @@ -11608,15 +11608,18 @@ static void f_json_decode(typval_T *argvars, typval_T *rettv) return; } tofree = s; + if (s == NULL) { + assert(len == 0); + s = ""; + } } else { s = (char *) get_tv_string_buf_chk(&argvars[0], (char_u *) numbuf); if (s) { len = strlen(s); + } else { + return; } } - if (s == NULL) { - return; - } if (json_decode_string(s, len, rettv) == FAIL) { emsgf(_("E474: Failed to parse %.*s"), (int) len, s); rettv->v_type = VAR_NUMBER; |