aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordefault <nobody@localhost>2025-02-08 16:59:26 +0100
committerdefault <nobody@localhost>2025-02-08 16:59:26 +0100
commit99d28c3d6c476a1d70b83a5685fbc53dcb74dc2f (patch)
tree83df35ed37c5c21f681fa3a0aeceaa057079e8e7
parent54fe489c5f1582cbc8d627eccf2fe575dd38100c (diff)
Fixed crash in incomplete poll post.
-rw-r--r--html.c19
1 files changed, 10 insertions, 9 deletions
diff --git a/html.c b/html.c
index f39bef4..e742e94 100644
--- a/html.c
+++ b/html.c
@@ -2099,16 +2099,17 @@ xs_html *html_entry(snac *user, xs_dict *msg, int read_only,
const char *name = xs_dict_get(v, "name");
const xs_dict *replies = xs_dict_get(v, "replies");
- if (name && replies) {
- char *ti = (char *)xs_number_str(xs_dict_get(replies, "totalItems"));
+ if (xs_is_string(name) && xs_is_dict(replies)) {
+ const char *ti = xs_number_str(xs_dict_get(replies, "totalItems"));
- xs_html_add(poll_result,
- xs_html_tag("tr",
- xs_html_tag("td",
- xs_html_text(name),
- xs_html_text(":")),
- xs_html_tag("td",
- xs_html_text(ti))));
+ if (xs_is_string(ti))
+ xs_html_add(poll_result,
+ xs_html_tag("tr",
+ xs_html_tag("td",
+ xs_html_text(name),
+ xs_html_text(":")),
+ xs_html_tag("td",
+ xs_html_text(ti))));
}
}