diff --git a/Services/News/classes/class.ilNewsForContextBlockGUI.php b/Services/News/classes/class.ilNewsForContextBlockGUI.php index 82e642eac45c..eb9c18eaf421 100755 --- a/Services/News/classes/class.ilNewsForContextBlockGUI.php +++ b/Services/News/classes/class.ilNewsForContextBlockGUI.php @@ -51,6 +51,7 @@ class ilNewsForContextBlockGUI extends ilBlockGUI protected ilHelpGUI $help; protected ilSetting $settings; protected ilTabsGUI $tabs; + protected ilLogger $logger; protected StandardGUIRequest $std_request; protected InternalDomainService $domain; @@ -68,6 +69,7 @@ public function __construct() $this->help = $DIC["ilHelp"]; $this->settings = $DIC->settings(); $this->tabs = $DIC->tabs(); + $this->logger = $DIC->logger()->news(); $locator = $DIC->news()->internal(); $this->std_request = $locator->gui()->standardRequest(); @@ -131,7 +133,13 @@ protected function preloadData(array $data): void protected function getListItemForData(array $data): ?\ILIAS\UI\Component\Item\Item { - $info = $this->getNewsForId($data[0]); + try { + $info = $this->getNewsForId($data[0]); + } catch (\Exception $e) { + $this->logger->error($e->getMessage()); + return $this->ui->factory()->item()->standard($this->lng->txt('news_sorry_not_accessible_anymore')); + } + $props = [ $this->lng->txt('date') => $info['creation_date'] ?? ''