Prevent the use of $shared_item if it's falsy in Mastodon\Status::createQuote

- Address https://github.com/friendica/friendica/issues/12488#issuecomment-1407342324
This commit is contained in:
Hypolite Petovan 2023-01-29 00:11:13 -05:00
parent 6dfa492521
commit 9a270de9c2

View file

@ -285,8 +285,7 @@ class Status extends BaseFactory
{
if (empty($item['quote-uri-id'])) {
$media = Post\Media::getByURIId($item['uri-id'], [Post\Media::ACTIVITY]);
if (!empty($media)) {
$shared_item = Post::selectFirst(['uri-id'], ['plink' => $media[0]['url'], 'uid' => [$uid, 0]]);
if (!empty($media) && $shared_item = Post::selectFirst(['uri-id'], ['plink' => $media[0]['url'], 'uid' => [$uid, 0]])) {
$quote_id = $shared_item['uri-id'];
}
} else {