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.
This commit is contained in:
Matt Kimball 2017-07-12 12:48:46 -07:00
parent 860a39cdf5
commit a535587757

View File

@ -364,11 +364,12 @@ void json_close(
} }
} }
if (at + 1 == max) { if (at + 1 == max) {
printf(" }]\n"); printf(" }");
} else { } else {
printf(" },\n"); printf(" },\n");
} }
} }
printf("]\n");
printf(" }\n"); printf(" }\n");
printf("}\n"); printf("}\n");
} }