Fixed crash.

This commit is contained in:
default 2023-10-16 18:40:43 +02:00
parent fbb773ae72
commit 8018f8c1d4

View file

@ -531,9 +531,14 @@ xs_dict *mastoapi_account(const xs_dict *actor)
xs *avatar = NULL; xs *avatar = NULL;
xs_dict *av = xs_dict_get(actor, "icon"); xs_dict *av = xs_dict_get(actor, "icon");
if (xs_type(av) == XSTYPE_DICT) if (xs_type(av) == XSTYPE_DICT) {
avatar = xs_dup(xs_dict_get(av, "url")); char *url = xs_dict_get(av, "url");
else
if (url != NULL)
avatar = xs_dup(url);
}
if (avatar == NULL)
avatar = xs_fmt("%s/susie.png", srv_baseurl); avatar = xs_fmt("%s/susie.png", srv_baseurl);
acct = xs_dict_append(acct, "avatar", avatar); acct = xs_dict_append(acct, "avatar", avatar);