From a535587757fe2834a224b874d96c4df1f251da05 Mon Sep 17 00:00:00 2001 From: Matt Kimball Date: Wed, 12 Jul 2017 12:48:46 -0700 Subject: [PATCH] json: Fix malformed json when the "hubs" list is empty When generating JSON output, and when no hosts are found when probing, the generated JSON was malformed. (i.e. when the "hubs" list in the generated JSON is empty, there was no closing bracket.) This can be reproduced by tracing to an unused host address on the local subnet. This fixues issue #190. --- ui/report.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ui/report.c b/ui/report.c index 7700391..54f6669 100644 --- a/ui/report.c +++ b/ui/report.c @@ -364,11 +364,12 @@ void json_close( } } if (at + 1 == max) { - printf(" }]\n"); + printf(" }"); } else { printf(" },\n"); } } + printf("]\n"); printf(" }\n"); printf("}\n"); } -- 2.47.2