From 4875524101ceb9ed90dc304db03bbd6cd0204be9 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Tue, 5 Jul 2022 18:51:29 +0200 Subject: [PATCH] Fixed: - added exception to prevent `TypeError` because of missing `uri-id` entry - maybe fixes #11708 --- src/Factory/Api/Mastodon/Account.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/Factory/Api/Mastodon/Account.php b/src/Factory/Api/Mastodon/Account.php index 0a647787a8..a3555302d6 100644 --- a/src/Factory/Api/Mastodon/Account.php +++ b/src/Factory/Api/Mastodon/Account.php @@ -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); } -- 2.39.5