Fixed:
- added exception to prevent `TypeError` because of missing `uri-id` entry - maybe fixes #11708
This commit is contained in:
parent
c88898df9c
commit
4875524101
1 changed files with 5 additions and 0 deletions
|
@ -60,9 +60,14 @@ class Account extends BaseFactory
|
||||||
public function createFromContactId(int $contactId, int $uid = 0): \Friendica\Object\Api\Mastodon\Account
|
public function createFromContactId(int $contactId, int $uid = 0): \Friendica\Object\Api\Mastodon\Account
|
||||||
{
|
{
|
||||||
$contact = Contact::getById($contactId, ['uri-id']);
|
$contact = Contact::getById($contactId, ['uri-id']);
|
||||||
|
|
||||||
if (empty($contact)) {
|
if (empty($contact)) {
|
||||||
throw new HTTPException\NotFoundException('Contact ' . $contactId . ' not found');
|
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);
|
return self::createFromUriId($contact['uri-id'], $uid);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue