Merge pull request #11709 from Quix0r/fixes/type-error-null-uri-id
Avoid TypeError because of missing "uri-id" entry
This commit is contained in:
commit
7b55f93027
|
@ -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 New Issue
Block a user