mirror of
https://codeberg.org/grunfink/snac2.git
synced 2024-11-21 21:05:05 +00:00
mastoapi: fixed crash in posts without 'published' field.
This commit is contained in:
parent
3a91185248
commit
781c0edcc6
1 changed files with 10 additions and 1 deletions
11
mastoapi.c
11
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, "url", id);
|
||||||
st = xs_dict_append(st, "account", acct);
|
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);
|
st = xs_dict_append(st, "created_at", fd);
|
||||||
|
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue