diff options
| author | 2024-11-20 15:59:36 +0100 | |
|---|---|---|
| committer | 2024-11-20 15:59:36 +0100 | |
| commit | 781c0edcc67b317fbba147a22da614dc3599c0d2 (patch) | |
| tree | b56899116ac92b4adf51cc362d722fca5583d2fc /mastoapi.c | |
| parent | Updated documentation. (diff) | |
| download | penes-snac2-781c0edcc67b317fbba147a22da614dc3599c0d2.tar.gz penes-snac2-781c0edcc67b317fbba147a22da614dc3599c0d2.tar.xz penes-snac2-781c0edcc67b317fbba147a22da614dc3599c0d2.zip | |
mastoapi: fixed crash in posts without 'published' field.
Diffstat (limited to 'mastoapi.c')
| -rw-r--r-- | mastoapi.c | 11 |
1 files changed, 10 insertions, 1 deletions
| @@ -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 | { |