summaryrefslogtreecommitdiff
path: root/mastoapi.c
diff options
context:
space:
mode:
authorGravatar default2024-11-20 15:59:36 +0100
committerGravatar default2024-11-20 15:59:36 +0100
commit781c0edcc67b317fbba147a22da614dc3599c0d2 (patch)
treeb56899116ac92b4adf51cc362d722fca5583d2fc /mastoapi.c
parentUpdated documentation. (diff)
downloadsnac2-781c0edcc67b317fbba147a22da614dc3599c0d2.tar.gz
snac2-781c0edcc67b317fbba147a22da614dc3599c0d2.tar.xz
snac2-781c0edcc67b317fbba147a22da614dc3599c0d2.zip
mastoapi: fixed crash in posts without 'published' field.
Diffstat (limited to 'mastoapi.c')
-rw-r--r--mastoapi.c11
1 files changed, 10 insertions, 1 deletions
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)
827 st = xs_dict_append(st, "url", id); 827 st = xs_dict_append(st, "url", id);
828 st = xs_dict_append(st, "account", acct); 828 st = xs_dict_append(st, "account", acct);
829 829
830 xs *fd = mastoapi_date(xs_dict_get(msg, "published")); 830 const char *published = xs_dict_get(msg, "published");
831 xs *fd = NULL;
832
833 if (published)
834 fd = mastoapi_date(published);
835 else {
836 xs *p = xs_str_iso_date(0);
837 fd = mastoapi_date(p);
838 }
839
831 st = xs_dict_append(st, "created_at", fd); 840 st = xs_dict_append(st, "created_at", fd);
832 841
833 { 842 {