From 1ea46958a0356c3b47f7acbac854c3c2a55cb13c Mon Sep 17 00:00:00 2001 From: Ekaitz Zarraga Date: Fri, 22 May 2020 12:02:58 +0200 Subject: [PATCH] Add possible common error --- lib/chibi/json.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/chibi/json.c b/lib/chibi/json.c index a3535423..1626f61c 100644 --- a/lib/chibi/json.c +++ b/lib/chibi/json.c @@ -516,6 +516,8 @@ sexp unparse_json (sexp ctx, sexp self, sexp obj) { res = sexp_c_string(ctx, "true", -1); } else if (obj == SEXP_NULL) { res = sexp_c_string(ctx, "null", -1); + } else if (sexp_pairp(obj)) { + res = sexp_json_unparse_exception(ctx, self, "unable to encode elemente: key-value pair out of object", obj); } else { res = sexp_json_unparse_exception(ctx, self, "unable to encode element", obj); }