mirror of
https://github.com/traviscross/mtr.git
synced 2024-09-22 02:47:11 +00:00
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:
parent
860a39cdf5
commit
a535587757
@ -364,11 +364,12 @@ void json_close(
|
||||
}
|
||||
}
|
||||
if (at + 1 == max) {
|
||||
printf(" }]\n");
|
||||
printf(" }");
|
||||
} else {
|
||||
printf(" },\n");
|
||||
}
|
||||
}
|
||||
printf("]\n");
|
||||
printf(" }\n");
|
||||
printf("}\n");
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user