commit 01c21d5

default  ·  2023-12-05 18:37:27 +0000 UTC
parent 756b0c9
mastoapi: fixed crash processing kbin boosts.
1 files changed,  +6, -2
+6, -2
 1@@ -1424,12 +1424,16 @@ int mastoapi_get_handler(const xs_dict *req, const char *q_path,
 2                 if (!xs_match(type, "Note|Question|Page|Article"))
 3                     continue;
 4 
 5-                const char *from;
 6+                const char *from = NULL;
 7                 if (strcmp(type, "Page") == 0)
 8                     from = xs_dict_get(msg, "audience");
 9-                else
10+
11+                if (from == NULL)
12                     from = xs_dict_get(msg, "attributedTo");
13 
14+                if (from == NULL)
15+                    continue;
16+
17                 /* is this message from a person we don't follow? */
18                 if (strcmp(from, snac1.actor) && !following_check(&snac1, from)) {
19                     /* discard if it was not boosted */