]> git.mxchange.org Git - friendica.git/commitdiff
Ward against nonexistant item in Item::prepareBody
authorHypolite Petovan <hypolite@mrpetovan.com>
Mon, 3 Apr 2023 04:05:40 +0000 (00:05 -0400)
committerHypolite Petovan <hypolite@mrpetovan.com>
Mon, 3 Apr 2023 04:05:40 +0000 (00:05 -0400)
- Address https://github.com/friendica/friendica/issues/12486#issuecomment-1492984392

src/Model/Item.php

index 5ba8ae1bf2980725ed69bc98dfdc6d6b5ed63522..aa334185993494ddc8d876e4efdf04ddc6007c41 100644 (file)
@@ -31,6 +31,7 @@ use Friendica\Core\System;
 use Friendica\Core\Worker;
 use Friendica\Database\DBA;
 use Friendica\DI;
+use Friendica\Network\HTTPException\InternalServerErrorException;
 use Friendica\Protocol\Activity;
 use Friendica\Protocol\ActivityPub;
 use Friendica\Protocol\Delivery;
@@ -1394,10 +1395,16 @@ class Item
         *
         * @param integer $uri_id
         * @return void
+        * @throws InternalServerErrorException
+        * @throws \ImagickException
         */
        public static function updateDisplayCache(int $uri_id)
        {
                $item = Post::selectFirst(self::DISPLAY_FIELDLIST, ['uri-id' => $uri_id]);
+               if (!$item) {
+                       return;
+               }
+
                self::prepareBody($item, false, false, true);
        }