From 7c6631f2d418604aaa8167862a5cbeb1dd5abe6e Mon Sep 17 00:00:00 2001 From: Alexander Guth Date: Wed, 3 Jul 2019 22:17:36 +0200 Subject: [PATCH] Fix error when $user is null I have no idea why the $user variable can ever be null in the first place, but for me it happens if I remove all main menu items (including the settings). The same check is already in place at the navigation manager: https://github.com/octobercms/october/blob/master/modules/backend/classes/NavigationManager.php#L509-L511 The change shouldn't brake anything. --- modules/system/classes/SettingsManager.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/modules/system/classes/SettingsManager.php b/modules/system/classes/SettingsManager.php index e6c679122..c77dcd2ff 100644 --- a/modules/system/classes/SettingsManager.php +++ b/modules/system/classes/SettingsManager.php @@ -365,6 +365,10 @@ class SettingsManager */ protected function filterItemPermissions($user, array $items) { + if (!$user) { + return $items; + } + $items = array_filter($items, function ($item) use ($user) { if (!$item->permissions || !count($item->permissions)) { return true;