commit 781c0ed
default
·
2024-11-20 14:59:36 +0000 UTC
parent 3a91185
mastoapi: fixed crash in posts without 'published' field.
1 files changed,
+10,
-1
+10,
-1
1@@ -827,7 +827,16 @@ xs_dict *mastoapi_status(snac *snac, const xs_dict *msg)
2 st = xs_dict_append(st, "url", id);
3 st = xs_dict_append(st, "account", acct);
4
5- xs *fd = mastoapi_date(xs_dict_get(msg, "published"));
6+ const char *published = xs_dict_get(msg, "published");
7+ xs *fd = NULL;
8+
9+ if (published)
10+ fd = mastoapi_date(published);
11+ else {
12+ xs *p = xs_str_iso_date(0);
13+ fd = mastoapi_date(p);
14+ }
15+
16 st = xs_dict_append(st, "created_at", fd);
17
18 {