- added exception to prevent `TypeError` because of missing `uri-id` entry
- maybe fixes #11708
This commit is contained in:
Roland Häder 2022-07-05 18:51:29 +02:00
parent c88898df9c
commit 4875524101
No known key found for this signature in database
GPG Key ID: C82EDE5DDFA0BA77

View File

@ -60,9 +60,14 @@ class Account extends BaseFactory
public function createFromContactId(int $contactId, int $uid = 0): \Friendica\Object\Api\Mastodon\Account
{
$contact = Contact::getById($contactId, ['uri-id']);
if (empty($contact)) {
throw new HTTPException\NotFoundException('Contact ' . $contactId . ' not found');
}
if (empty($contact['uri-id'])) {
throw new HTTPException\NotFoundException('Contact ' . $contactId . ' has no uri-id set');
}
return self::createFromUriId($contact['uri-id'], $uid);
}