From: Hypolite Petovan Date: Mon, 28 Dec 2020 02:15:21 +0000 (-0500) Subject: Throw exception when item doesn't exist in Factory\Api\Mastodon\Status->createFromUriId X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=8c1e2b9800db082599aa7d29faa66e6c66e676bb;p=friendica.git Throw exception when item doesn't exist in Factory\Api\Mastodon\Status->createFromUriId - Address https://github.com/friendica/friendica/issues/9250#issuecomment-750464977 --- diff --git a/src/Factory/Api/Mastodon/Status.php b/src/Factory/Api/Mastodon/Status.php index cd468a5fbd..e1c11de6cb 100644 --- a/src/Factory/Api/Mastodon/Status.php +++ b/src/Factory/Api/Mastodon/Status.php @@ -61,6 +61,10 @@ class Status extends BaseFactory public function createFromUriId(int $uriId, $uid = 0) { $item = Item::selectFirst([], ['uri-id' => $uriId, 'uid' => $uid]); + if (!$item) { + throw new HTTPException\NotFoundException('Item with URI ID ' . $uriId . 'not found' . ($uid ? ' for user ' . $uid : '.')); + } + $account = DI::mstdnAccount()->createFromContactId($item['author-id']); $counts = new \Friendica\Object\Api\Mastodon\Status\Counts(