From d526eb8a76fd2b741000b894fd4716bc2900764b Mon Sep 17 00:00:00 2001 From: Con Kolivas Date: Mon, 22 Sep 2014 21:59:26 +1000 Subject: [PATCH] Mask out (null) as a valid result in json_result --- src/generator.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/generator.c b/src/generator.c index b818df38..c94cfccc 100644 --- a/src/generator.c +++ b/src/generator.c @@ -412,9 +412,11 @@ static json_t *json_result(json_t *val) json_t *res_val = NULL, *err_val; res_val = json_object_get(val, "result"); + /* (null) is a valid result while no value is an error, so mask out + * (null) and only handle lack of result */ if (json_is_null(res_val)) res_val = NULL; - if (!res_val) { + else if (!res_val) { char *ss; err_val = json_object_get(val, "error");