diff options
| author | default <nobody@localhost> | 2025-01-08 19:56:15 +0100 |
|---|---|---|
| committer | default <nobody@localhost> | 2025-01-08 19:56:15 +0100 |
| commit | 935a0a5a7d9f50427fe15b0a8b947d51db177cdc (patch) | |
| tree | 084f91f5aec5c4846e1bc30b0cf9564e75afb2ac /html.c | |
| parent | a6dce9953889156b485405c7de2bd954587b2ddc (diff) | |
Fixed crash on NULL hashtag href.
Diffstat (limited to 'html.c')
| -rw-r--r-- | html.c | 23 |
1 files changed, 13 insertions, 10 deletions
@@ -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(" ")))); + } } } } |