From: Michael Date: Thu, 1 Dec 2022 07:07:59 +0000 (+0000) Subject: Don't fetch sugestions for the system user / catch error on contact timeline X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=1d00947bcde4b75cec21c9bf813ef8f109bafc1b;p=friendica.git Don't fetch sugestions for the system user / catch error on contact timeline --- diff --git a/src/Model/Contact/Relation.php b/src/Model/Contact/Relation.php index bae59f48c5..5616148fa0 100644 --- a/src/Model/Contact/Relation.php +++ b/src/Model/Contact/Relation.php @@ -323,6 +323,10 @@ class Relation */ static public function getSuggestions(int $uid, int $start = 0, int $limit = 80): array { + if ($uid == 0) { + return []; + } + $cid = Contact::getPublicIdByUserId($uid); $totallimit = $start + $limit; $contacts = []; diff --git a/src/Module/Api/Mastodon/Accounts/Statuses.php b/src/Module/Api/Mastodon/Accounts/Statuses.php index b244c56fb2..7de8699401 100644 --- a/src/Module/Api/Mastodon/Accounts/Statuses.php +++ b/src/Module/Api/Mastodon/Accounts/Statuses.php @@ -21,6 +21,7 @@ namespace Friendica\Module\Api\Mastodon\Accounts; +use Friendica\Core\Logger; use Friendica\Core\Protocol; use Friendica\Core\System; use Friendica\Database\DBA; @@ -113,7 +114,11 @@ class Statuses extends BaseApi $statuses = []; while ($item = Post::fetch($items)) { self::setBoundaries($item['uri-id']); - $statuses[] = DI::mstdnStatus()->createFromUriId($item['uri-id'], $uid); + try { + $statuses[] = DI::mstdnStatus()->createFromUriId($item['uri-id'], $uid); + } catch (\Throwable $th) { + Logger::info('Post not fetchable', ['uri-id' => $item['uri-id'], 'uid' => $uid, 'error' => $th]); + } } DBA::close($items);