From a5384aaea6ff488fe29cdf9f8874a54a08e52963 Mon Sep 17 00:00:00 2001 From: Jean-Christian Denis Date: Sun, 23 Apr 2023 13:54:09 +0200 Subject: [PATCH] fix nullsafe warnings --- src/Backend.php | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/Backend.php b/src/Backend.php index 9830388..b25876e 100644 --- a/src/Backend.php +++ b/src/Backend.php @@ -14,7 +14,6 @@ declare(strict_types=1); namespace Dotclear\Plugin\postExpired; -use dcAuth; use dcCore; use dcNsProcess; @@ -22,10 +21,15 @@ class Backend extends dcNsProcess { public static function init(): bool { - static::$init = defined('DC_CONTEXT_ADMIN') && dcCore::app()->auth->check( - dcCore::app()->auth->makePermissions([dcAuth::PERMISSION_CONTENT_ADMIN]), - dcCore::app()->blog->id - ); + static::$init = defined('DC_CONTEXT_ADMIN') + && !is_null(dcCore::app()->auth) && !is_null(dcCore::app()->blog) + && dcCore::app()->auth->check( + dcCore::app()->auth->makePermissions( + [ + dcCore::app()->auth::PERMISSION_CONTENT_ADMIN] + ), + dcCore::app()->blog->id + ); return static::$init; }