From 781c0edcc67b317fbba147a22da614dc3599c0d2 Mon Sep 17 00:00:00 2001 From: default Date: Wed, 20 Nov 2024 15:59:36 +0100 Subject: [PATCH] mastoapi: fixed crash in posts without 'published' field. --- mastoapi.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/mastoapi.c b/mastoapi.c index 1dd91dc..a529990 100644 --- a/mastoapi.c +++ b/mastoapi.c @@ -827,7 +827,16 @@ xs_dict *mastoapi_status(snac *snac, const xs_dict *msg) st = xs_dict_append(st, "url", id); st = xs_dict_append(st, "account", acct); - xs *fd = mastoapi_date(xs_dict_get(msg, "published")); + const char *published = xs_dict_get(msg, "published"); + xs *fd = NULL; + + if (published) + fd = mastoapi_date(published); + else { + xs *p = xs_str_iso_date(0); + fd = mastoapi_date(p); + } + st = xs_dict_append(st, "created_at", fd); {