eval: Treat [] and [""] as any other empty string

This commit is contained in:
ZyX
2016-03-20 20:03:12 +03:00
parent af7ff808c7
commit 9af400f979
2 changed files with 10 additions and 3 deletions

View File

@@ -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;