aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordefault <nobody@localhost>2025-01-08 19:56:15 +0100
committerdefault <nobody@localhost>2025-01-08 19:56:15 +0100
commit935a0a5a7d9f50427fe15b0a8b947d51db177cdc (patch)
tree084f91f5aec5c4846e1bc30b0cf9564e75afb2ac
parenta6dce9953889156b485405c7de2bd954587b2ddc (diff)
Fixed crash on NULL hashtag href.
-rw-r--r--html.c23
1 files changed, 13 insertions, 10 deletions
diff --git a/html.c b/html.c
index 7c46c76..294faa3 100644
--- a/html.c
+++ b/html.c
@@ -2205,18 +2205,21 @@ xs_html *html_entry(snac *user, xs_dict *msg, int read_only,
if (xs_type(type) == XSTYPE_STRING && strcmp(type, "Hashtag") == 0) {
const char *o_href = xs_dict_get(tag, "href");
- xs *href = xs_utf8_to_lower(o_href);
- if (xs_type(href) == XSTYPE_STRING && xs_str_in(content, href) == -1) {
- /* not in the content: add here */
- const char *name = xs_dict_get(tag, "name");
+ if (xs_type(o_href) == XSTYPE_STRING) {
+ xs *href = xs_utf8_to_lower(o_href);
- xs_html_add(add_hashtags,
- xs_html_tag("li",
- xs_html_tag("a",
- xs_html_attr("href", href),
- xs_html_text(name),
- xs_html_text(" "))));
+ if (xs_type(href) == XSTYPE_STRING && xs_str_in(content, href) == -1) {
+ /* not in the content: add here */
+ const char *name = xs_dict_get(tag, "name");
+
+ xs_html_add(add_hashtags,
+ xs_html_tag("li",
+ xs_html_tag("a",
+ xs_html_attr("href", href),
+ xs_html_text(name),
+ xs_html_text(" "))));
+ }
}
}
}