fix nullsafe warnings
This commit is contained in:
parent
efe8358c78
commit
9a2848128f
@ -10,7 +10,7 @@
|
||||
* @copyright Jean-Christian Denis
|
||||
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
||||
*/
|
||||
if (!defined('DC_RC_PATH')) {
|
||||
if (!defined('DC_RC_PATH') || is_null(dcCore::app()->auth)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -22,7 +22,7 @@ $this->registerModule(
|
||||
[
|
||||
'requires' => [['core', '2.26']],
|
||||
'permissions' => dcCore::app()->auth->makePermissions([
|
||||
dcAuth::PERMISSION_ADMIN,
|
||||
dcCore::app()->auth::PERMISSION_ADMIN,
|
||||
]),
|
||||
'type' => 'plugin',
|
||||
'support' => 'https://github.com/JcDenis/' . basename(__DIR__),
|
||||
|
@ -43,6 +43,11 @@ class Backend extends dcNsProcess
|
||||
|
||||
dcCore::app()->addBehaviors([
|
||||
'adminBlogPreferencesFormV2' => function (dcSettings $blog_settings): void {
|
||||
// nullsafe
|
||||
if (is_null(dcCore::app()->blog)) {
|
||||
return;
|
||||
}
|
||||
|
||||
$exists = [];
|
||||
$path = Path::fullFromRoot((string) $blog_settings->get('system')->get('public_path'), DC_ROOT);
|
||||
foreach (['ico', 'png', 'bmp', 'gif', 'jpg', 'mng'] as $ext) {
|
||||
|
@ -34,7 +34,7 @@ class Frontend extends dcNsProcess
|
||||
}
|
||||
|
||||
dcCore::app()->addBehavior('publicHeadContent', function (): void {
|
||||
if (!dcCore::app()->blog->settings->get('system')->get('simply_favicon')) {
|
||||
if (is_null(dcCore::app()->blog) || !dcCore::app()->blog->settings->get('system')->get('simply_favicon')) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -31,6 +31,11 @@ class UrlHandler extends dcUrlHandlers
|
||||
|
||||
public static function simplyFaviconUrl(string $arg): void
|
||||
{
|
||||
// nullsafe
|
||||
if (is_null(dcCore::app()->blog)) {
|
||||
return;
|
||||
}
|
||||
|
||||
$public_path = Path::fullFromRoot(dcCore::app()->blog->settings->get('system')->get('public_path'), DC_ROOT);
|
||||
|
||||
if (dcCore::app()->blog->settings->get('system')->get('simply_favicon')
|
||||
|
Loading…
Reference in New Issue
Block a user