summaryrefslogtreecommitdiff
path: root/mastoapi.c
diff options
context:
space:
mode:
authordefault <nobody@localhost>2023-12-05 19:37:27 +0100
committerdefault <nobody@localhost>2023-12-05 19:37:27 +0100
commit01c21d57ec6d09416474ea71f067ee7438005635 (patch)
treedd133e02ef3cbb57ce4f91935b5b8d60dd7078bd /mastoapi.c
parent756b0c98ee7ae36f28c166dee286e177cfe62f19 (diff)
mastoapi: fixed crash processing kbin boosts.
Diffstat (limited to 'mastoapi.c')
-rw-r--r--mastoapi.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/mastoapi.c b/mastoapi.c
index 46a6eab..426e692 100644
--- a/mastoapi.c
+++ b/mastoapi.c
@@ -1424,12 +1424,16 @@ int mastoapi_get_handler(const xs_dict *req, const char *q_path,
if (!xs_match(type, "Note|Question|Page|Article"))
continue;
- const char *from;
+ const char *from = NULL;
if (strcmp(type, "Page") == 0)
from = xs_dict_get(msg, "audience");
- else
+
+ if (from == NULL)
from = xs_dict_get(msg, "attributedTo");
+ if (from == NULL)
+ continue;
+
/* is this message from a person we don't follow? */
if (strcmp(from, snac1.actor) && !following_check(&snac1, from)) {
/* discard if it was not boosted */