commit 1210740
default
·
2025-05-06 05:28:43 +0000 UTC
parent b84a2ec
Fixed crash.
1 files changed,
+18,
-14
M
format.c
M
format.c
+18,
-14
1@@ -161,15 +161,17 @@ static xs_str *format_line(const char *line, xs_list **attach)
2
3 s = xs_str_cat(s, link);
4
5- /* also add the link as an attachment */
6- xs *d = xs_dict_new();
7+ if (attach) {
8+ /* also add the link as an attachment */
9+ xs *d = xs_dict_new();
10
11- d = xs_dict_append(d, "mediaType", "text/html");
12- d = xs_dict_append(d, "url", url);
13- d = xs_dict_append(d, "name", name);
14- d = xs_dict_append(d, "type", "Link");
15+ d = xs_dict_append(d, "mediaType", "text/html");
16+ d = xs_dict_append(d, "url", url);
17+ d = xs_dict_append(d, "name", name);
18+ d = xs_dict_append(d, "type", "Link");
19
20- *attach = xs_list_append(*attach, d);
21+ *attach = xs_list_append(*attach, d);
22+ }
23 }
24 else
25 s = xs_str_cat(s, v);
26@@ -254,15 +256,17 @@ static xs_str *format_line(const char *line, xs_list **attach)
27 xs *s1 = xs_fmt("<a href=\"%s\" target=\"_blank\">%s</a>", v2, u);
28 s = xs_str_cat(s, s1);
29
30- /* also add the link as an attachment */
31- xs *d = xs_dict_new();
32+ if (attach) {
33+ /* also add the link as an attachment */
34+ xs *d = xs_dict_new();
35
36- d = xs_dict_append(d, "mediaType", "text/html");
37- d = xs_dict_append(d, "url", v2);
38- d = xs_dict_append(d, "name", "");
39- d = xs_dict_append(d, "type", "Link");
40+ d = xs_dict_append(d, "mediaType", "text/html");
41+ d = xs_dict_append(d, "url", v2);
42+ d = xs_dict_append(d, "name", "");
43+ d = xs_dict_append(d, "type", "Link");
44
45- *attach = xs_list_append(*attach, d);
46+ *attach = xs_list_append(*attach, d);
47+ }
48 }
49 }
50 else