From 890ef253077099344f2d68b379398e80fc3cc6aa Mon Sep 17 00:00:00 2001 From: Jean-Christian Denis Date: Sun, 23 Apr 2023 22:31:23 +0200 Subject: [PATCH] fix nullsafe warning --- src/Backend.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/Backend.php b/src/Backend.php index 27e960d..898df5b 100644 --- a/src/Backend.php +++ b/src/Backend.php @@ -52,7 +52,9 @@ class Backend extends dcNsProcess public static function init(): bool { - static::$init = defined('DC_CONTEXT_ADMIN') && dcCore::app()->auth->isSuperAdmin(); + static::$init = defined('DC_CONTEXT_ADMIN') + && !is_null(dcCore::app()->auth) + && dcCore::app()->auth->isSuperAdmin(); return static::$init; } @@ -75,6 +77,11 @@ class Backend extends dcNsProcess ) : ''; }, 'adminModulesListDoActions' => function (adminModulesList $list, array $modules, string $type): void { + # nullsafe + if (is_null(dcCore::app()->blog)) { + return; + } + # Pack action if (empty($_POST[self::id()]) || !is_array($_POST[self::id()])) {