fixes null attachment bug

This commit is contained in:
buttle 2021-05-17 22:23:33 +02:00
parent 80662a6c9e
commit a080748677
1 changed files with 4 additions and 2 deletions

View File

@ -81,11 +81,13 @@ class ArchiveSiteMetaViewHelper extends AbstractHelper
foreach ($page->blocks() as $block) { foreach ($page->blocks() as $block) {
if ($block->layout() === 'archiveSiteMeta') { if ($block->layout() === 'archiveSiteMeta') {
$attachments = $block->attachments(); $attachments = $block->attachments();
if ($attachments) {
$media = $attachments[0]->item()->media()[0]; $media = $attachments[0]->item()->media()[0];
return $media->primaryMedia()->thumbnailUrl('large'); return $media->primaryMedia()->thumbnailUrl('large');
} }
} }
} }
}
return null; return null;
} }