From 0cdfa2c373fa58e04e273e999b268209387e121b Mon Sep 17 00:00:00 2001 From: Ron Lucke <lucke@elan-ev.de> Date: Mon, 4 Oct 2021 08:35:51 +0000 Subject: [PATCH] fix #257 --- lib/models/Courseware/Block.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/models/Courseware/Block.php b/lib/models/Courseware/Block.php index c168462f09a..48009fe8697 100755 --- a/lib/models/Courseware/Block.php +++ b/lib/models/Courseware/Block.php @@ -104,8 +104,12 @@ class Block extends \SimpleORMap $config['additional_fields']['files'] = [ 'get' => function ($block) { return array_filter($block->type->getFiles(), function ($file_ref) { - $file = $file_ref->getFileType(); - return $file->isDownloadable(); + if ($file_ref) { + $file = $file_ref->getFileType(); + return $file->isDownloadable(); + } else { + return false; + } }); }, ]; -- GitLab