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,8 +81,10 @@ 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();
$media = $attachments[0]->item()->media()[0]; if ($attachments) {
return $media->primaryMedia()->thumbnailUrl('large'); $media = $attachments[0]->item()->media()[0];
return $media->primaryMedia()->thumbnailUrl('large');
}
} }
} }
} }