From b8b19abed2f1dedadb629412ddde836ce3cf1d43 Mon Sep 17 00:00:00 2001 From: Hugo Sales Date: Mon, 15 Nov 2021 17:09:14 +0000 Subject: [PATCH] [ENTITY][AttachmentThumbnail] Do not attempt to check if a file exists if the path is null --- src/Entity/AttachmentThumbnail.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Entity/AttachmentThumbnail.php b/src/Entity/AttachmentThumbnail.php index 819c941c12..ca43c1301f 100644 --- a/src/Entity/AttachmentThumbnail.php +++ b/src/Entity/AttachmentThumbnail.php @@ -212,7 +212,7 @@ class AttachmentThumbnail extends Entity return null; } [$predicted_width, $predicted_height] = self::predictScalingValues($attachment->getWidth(), $attachment->getHeight(), $size, $crop); - if (!file_exists($attachment->getPath())) { + if (\is_null($attachment->getPath()) || !file_exists($attachment->getPath())) { // Before we quit, check if there's any other thumb $alternative_thumbs = DB::findBy('attachment_thumbnail', ['attachment_id' => $attachment->getId()]); usort($alternative_thumbs, fn ($l, $r) => $r->getSize() <=> $l->getSize());