diff options
Diffstat (limited to 'apps/theming/lib/Controller/UserThemeController.php')
-rw-r--r-- | apps/theming/lib/Controller/UserThemeController.php | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/apps/theming/lib/Controller/UserThemeController.php b/apps/theming/lib/Controller/UserThemeController.php index a227e72d998..6a58366c4f6 100644 --- a/apps/theming/lib/Controller/UserThemeController.php +++ b/apps/theming/lib/Controller/UserThemeController.php @@ -50,16 +50,14 @@ use OCP\PreConditionNotMetException; class UserThemeController extends OCSController { - protected string $userId; + protected ?string $userId = null; + private IConfig $config; private IUserSession $userSession; private ThemesService $themesService; private ThemingDefaults $themingDefaults; private BackgroundService $backgroundService; - /** - * Config constructor. - */ public function __construct(string $appName, IRequest $request, IConfig $config, @@ -73,7 +71,11 @@ class UserThemeController extends OCSController { $this->themesService = $themesService; $this->themingDefaults = $themingDefaults; $this->backgroundService = $backgroundService; - $this->userId = $userSession->getUser()->getUID(); + + $user = $userSession->getUser(); + if ($user !== null) { + $this->userId = $user->getUID(); + } } /** |