aboutsummaryrefslogtreecommitdiff
path: root/format.c
diff options
context:
space:
mode:
authordefault <nobody@localhost>2025-05-06 07:28:43 +0200
committerdefault <nobody@localhost>2025-05-06 07:28:43 +0200
commit12107401ea2721edbfb8affacefb242409dd271f (patch)
tree830bb41033575a2f9b13c2a22befae0660c693cc /format.c
parentb84a2ec87d64e16a4044b12d74247321b17c6925 (diff)
Fixed crash.
Diffstat (limited to 'format.c')
-rw-r--r--format.c32
1 files changed, 18 insertions, 14 deletions
diff --git a/format.c b/format.c
index 862d766..b3764ef 100644
--- a/format.c
+++ b/format.c
@@ -161,15 +161,17 @@ static xs_str *format_line(const char *line, xs_list **attach)
s = xs_str_cat(s, link);
- /* also add the link as an attachment */
- xs *d = xs_dict_new();
+ if (attach) {
+ /* also add the link as an attachment */
+ xs *d = xs_dict_new();
- d = xs_dict_append(d, "mediaType", "text/html");
- d = xs_dict_append(d, "url", url);
- d = xs_dict_append(d, "name", name);
- d = xs_dict_append(d, "type", "Link");
+ d = xs_dict_append(d, "mediaType", "text/html");
+ d = xs_dict_append(d, "url", url);
+ d = xs_dict_append(d, "name", name);
+ d = xs_dict_append(d, "type", "Link");
- *attach = xs_list_append(*attach, d);
+ *attach = xs_list_append(*attach, d);
+ }
}
else
s = xs_str_cat(s, v);
@@ -254,15 +256,17 @@ static xs_str *format_line(const char *line, xs_list **attach)
xs *s1 = xs_fmt("<a href=\"%s\" target=\"_blank\">%s</a>", v2, u);
s = xs_str_cat(s, s1);
- /* also add the link as an attachment */
- xs *d = xs_dict_new();
+ if (attach) {
+ /* also add the link as an attachment */
+ xs *d = xs_dict_new();
- d = xs_dict_append(d, "mediaType", "text/html");
- d = xs_dict_append(d, "url", v2);
- d = xs_dict_append(d, "name", "");
- d = xs_dict_append(d, "type", "Link");
+ d = xs_dict_append(d, "mediaType", "text/html");
+ d = xs_dict_append(d, "url", v2);
+ d = xs_dict_append(d, "name", "");
+ d = xs_dict_append(d, "type", "Link");
- *attach = xs_list_append(*attach, d);
+ *attach = xs_list_append(*attach, d);
+ }
}
}
else