From ae8bb8debac7987ee3a01c708260af3ac36ddde8 Mon Sep 17 00:00:00 2001 From: Jean-Christian Denis Date: Thu, 20 Apr 2023 20:52:03 +0200 Subject: [PATCH] cosmetic nullsafe fix --- src/Frontend.php | 5 +++++ src/Widgets.php | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/src/Frontend.php b/src/Frontend.php index a04b23f..fc8227d 100644 --- a/src/Frontend.php +++ b/src/Frontend.php @@ -36,6 +36,11 @@ class Frontend extends dcNsProcess dcCore::app()->addBehaviors([ // template path 'publicBeforeDocumentV2' => function (): void { + // nullsafe PHP < 8.0 + if (is_null(dcCore::app()->blog)) { + return ; + } + $tplset = dcCore::app()->themes->moduleInfo(dcCore::app()->blog->settings->get('system')->get('theme'), 'tplset'); if (!empty($tplset) && is_dir(implode(DIRECTORY_SEPARATOR, [My::root(), 'default-templates', $tplset]))) { dcCore::app()->tpl->setPath(dcCore::app()->tpl->getPath(), implode(DIRECTORY_SEPARATOR, [My::root(), 'default-templates', $tplset])); diff --git a/src/Widgets.php b/src/Widgets.php index 048b2cf..b562ca9 100644 --- a/src/Widgets.php +++ b/src/Widgets.php @@ -44,6 +44,11 @@ class Widgets return ''; } + // nullsafe PHP < 8.0 + if (is_null(dcCore::app()->blog)) { + return ''; + } + return $w->renderDiv( (bool) $w->content_only, My::id() . ' ' . $w->class,