export-html: prevent invalid json

A dive without events could lead to json with extra closing brackets that
prevents browsers from rendering the dive log.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Dirk Hohndel 2024-11-03 12:33:03 -08:00 committed by bstoeger
parent 8e9010a000
commit e7900c514c

View file

@ -92,7 +92,8 @@ static void write_dive_status(struct membuffer *b, const struct dive &dive)
static void put_HTML_bookmarks(struct membuffer *b, const struct dive &dive) static void put_HTML_bookmarks(struct membuffer *b, const struct dive &dive)
{ {
const char *separator = "\"events\":["; const char *separator = "";
put_string(b, "\"events\":[");
for (const auto &ev: dive.dcs[0].events) { for (const auto &ev: dive.dcs[0].events) {
put_string(b, separator); put_string(b, separator);
separator = ", "; separator = ", ";