commit bd0149e

default  ·  2022-12-03 19:45:58 +0000 UTC
parent 76bfc36
Don't try to admire empty messages.
1 files changed,  +10, -4
M html.c
M html.c
+10, -4
 1@@ -1288,14 +1288,20 @@ int html_post_handler(d_char *req, char *q_path, d_char *payload, int p_size,
 2 
 3         if (strcmp(action, L("Like")) == 0) {
 4             xs *msg = msg_admiration(&snac, id, "Like");
 5-            post(&snac, msg);
 6-            timeline_admire(&snac, msg, id, snac.actor, 1);
 7+
 8+            if (msg != NULL) {
 9+                post(&snac, msg);
10+                timeline_admire(&snac, msg, id, snac.actor, 1);
11+            }
12         }
13         else
14         if (strcmp(action, L("Boost")) == 0) {
15             xs *msg = msg_admiration(&snac, id, "Announce");
16-            post(&snac, msg);
17-            timeline_admire(&snac, msg, id, snac.actor, 0);
18+
19+            if (msg != NULL) {
20+                post(&snac, msg);
21+                timeline_admire(&snac, msg, id, snac.actor, 0);
22+            }
23         }
24         else
25         if (strcmp(action, L("MUTE")) == 0) {