[ENTITY][AttachmentThumbnail] Do not attempt to check if a file exists if the path is null

This commit is contained in:
Hugo Sales 2021-11-15 17:09:14 +00:00
parent 5cafc80d01
commit b8b19abed2
Signed by untrusted user: someonewithpc
GPG Key ID: 7D0C7EAFC9D835A0

View File

@ -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());