commit 5a42184

default  ·  2024-07-11 07:26:26 +0000 UTC
parent a7344d2
Do nothing on polls without any vote.
1 files changed,  +5, -4
M html.c
M html.c
+5, -4
 1@@ -3442,15 +3442,16 @@ int html_post_handler(const xs_dict *req, const char *q_path,
 2         /* multiple choices? */
 3         if (xs_type(opt) == XSTYPE_LIST)
 4             ls = xs_dup(opt);
 5-        else {
 6+        else
 7+        if (xs_type(opt) == XSTYPE_STRING) {
 8             ls = xs_list_new();
 9             ls = xs_list_append(ls, opt);
10         }
11 
12-        xs_list *p = ls;
13         const xs_str *v;
14+        int c = 0;
15 
16-        while (xs_list_iter(&p, &v)) {
17+        while (xs_list_next(ls, &v, &c)) {
18             xs *msg = msg_note(&snac, "", actor, irt, NULL, 1);
19 
20             /* set the option */
21@@ -3463,7 +3464,7 @@ int html_post_handler(const xs_dict *req, const char *q_path,
22             timeline_add(&snac, xs_dict_get(msg, "id"), msg);
23         }
24 
25-        {
26+        if (ls != NULL) {
27             /* get the poll object */
28             xs *poll = NULL;
29