From 574c0ca8af8c7cba9a5a3e3468ab7a477bfd496e Mon Sep 17 00:00:00 2001 From: default Date: Thu, 10 Aug 2023 19:37:33 +0200 Subject: [PATCH] Fixed some mastoapi minor errors. --- mastoapi.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/mastoapi.c b/mastoapi.c index b5c42c8..dbb6e11 100644 --- a/mastoapi.c +++ b/mastoapi.c @@ -1108,7 +1108,8 @@ int mastoapi_get_handler(const xs_dict *req, const char *q_path, xs_startswith(xs_dict_get(msg, "id"), snac2.actor)) { xs *st = mastoapi_status(&snac2, msg); - out = xs_list_append(out, st); + if (st) + out = xs_list_append(out, st); } } } @@ -1354,7 +1355,9 @@ int mastoapi_get_handler(const xs_dict *req, const char *q_path, if (strcmp(type, "follow") != 0 && !xs_is_null(objid)) { xs *st = mastoapi_status(&snac1, entry); - mn = xs_dict_append(mn, "status", st); + + if (st) + mn = xs_dict_append(mn, "status", st); } out = xs_list_append(out, mn); @@ -1541,7 +1544,9 @@ int mastoapi_get_handler(const xs_dict *req, const char *q_path, if (valid_status(timeline_get_by_md5(&snac1, pid, &m2))) { xs *st = mastoapi_status(&snac1, m2); - anc = xs_list_insert(anc, 0, st); + + if (st) + anc = xs_list_insert(anc, 0, st); } else break; @@ -1557,7 +1562,9 @@ int mastoapi_get_handler(const xs_dict *req, const char *q_path, if (valid_status(timeline_get_by_md5(&snac1, v, &m2))) { if (xs_is_null(xs_dict_get(m2, "name"))) { xs *st = mastoapi_status(&snac1, m2); - des = xs_list_append(des, st); + + if (st) + des = xs_list_append(des, st); } } }