]> git.mxchange.org Git - friendica.git/commitdiff
Fixed:
authorRoland Häder <roland@mxchange.org>
Tue, 5 Jul 2022 16:51:29 +0000 (18:51 +0200)
committerRoland Häder <roland@mxchange.org>
Tue, 5 Jul 2022 16:53:51 +0000 (18:53 +0200)
- added exception to prevent `TypeError` because of missing `uri-id` entry
- maybe fixes #11708

src/Factory/Api/Mastodon/Account.php

index 0a647787a86dbdf7d48a98c15951a6d0548d5650..a3555302d62efec9e864854fb05df2fbeb899e29 100644 (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);
        }