From 9a323e17b449ff2ac09336e11263c6cca00a45ea Mon Sep 17 00:00:00 2001 From: Martin Schanzenbach Date: Sun, 10 May 2020 11:18:50 +0200 Subject: [PATCH] only include result set of not empty after filtering --- src/namestore/plugin_rest_namestore.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/namestore/plugin_rest_namestore.c b/src/namestore/plugin_rest_namestore.c index 4184d93a1..5a7e8c6cf 100644 --- a/src/namestore/plugin_rest_namestore.c +++ b/src/namestore/plugin_rest_namestore.c @@ -525,10 +525,14 @@ namestore_list_iteration (void *cls, rd_filtered[j].data = rd[i].data; j++; } - record_obj = GNUNET_JSON_from_gnsrecord (rname, - rd_filtered, - j); - json_array_append_new (handle->resp_object, record_obj); + /** Only add if not empty **/ + if (j > 0) + { + record_obj = GNUNET_JSON_from_gnsrecord (rname, + rd_filtered, + j); + json_array_append_new (handle->resp_object, record_obj); + } GNUNET_NAMESTORE_zone_iterator_next (handle->list_it, 1); } -- 2.25.1