commit 442ba99

default  ·  2023-08-29 17:38:53 +0000 UTC
parent 29896e2
Minor tweak to avoid possible undefined behaviour.
1 files changed,  +8, -3
M html.c
M html.c
+8, -3
 1@@ -1147,10 +1147,12 @@ xs_str *html_entry(snac *user, xs_str *os, const xs_dict *msg, int local,
 2                 /* not a list */
 3                 tag = xs_list_new();
 4                 tag = xs_list_append(tag, p);
 5-            } else {
 6-                /* is a list */
 7-                tag = xs_dup(p);
 8             }
 9+            else
10+            if (xs_type(p) == XSTYPE_LIST)
11+                tag = xs_dup(p);
12+            else
13+                tag = xs_list_new();
14 
15             xs_list *tags = tag;
16 
17@@ -1291,7 +1293,10 @@ xs_str *html_entry(snac *user, xs_str *os, const xs_dict *msg, int local,
18             attach = xs_list_append(attach, v);
19         }
20         else
21+        if (xs_type(v) == XSTYPE_LIST)
22             attach = xs_dup(v);
23+        else
24+            attach = xs_list_new();
25 
26         /* does the message have an image? */
27         if (xs_type(v = xs_dict_get(msg, "image")) == XSTYPE_DICT) {