]> git.mxchange.org Git - friendica.git/commitdiff
Prevent the use of $shared_item if it's falsy in Mastodon\Status::createQuote
authorHypolite Petovan <hypolite@mrpetovan.com>
Sun, 29 Jan 2023 05:11:13 +0000 (00:11 -0500)
committerHypolite Petovan <hypolite@mrpetovan.com>
Sun, 29 Jan 2023 05:11:13 +0000 (00:11 -0500)
- Address https://github.com/friendica/friendica/issues/12488#issuecomment-1407342324

src/Factory/Api/Mastodon/Status.php

index acc7afeb5e2e3329c373e52590a3a7e917ebbb55..9f6d3bcde95877dfa47addf0e6a61d2d007b86c9 100644 (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 {