Ward against nonexistant item in Item::prepareBody

- Address https://github.com/friendica/friendica/issues/12486#issuecomment-1492984392
This commit is contained in:
Hypolite Petovan 2023-04-03 00:05:40 -04:00
parent c673c478ee
commit e7628af15f

View File

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