diff --git a/lib/private/TemplateLayout.php b/lib/private/TemplateLayout.php index d9c02619943b3..374972ece22f4 100644 --- a/lib/private/TemplateLayout.php +++ b/lib/private/TemplateLayout.php @@ -198,8 +198,13 @@ public function getPageTemplate(string $renderAs, string $appId): ITemplate { $page->assign('direction', $direction); // Set body data-theme - $themesService = Server::get(\OCA\Theming\Service\ThemesService::class); - $page->assign('enabledThemes', $themesService->getEnabledThemes()); + try { + $themesService = Server::get(\OCA\Theming\Service\ThemesService::class); + } catch (\OCP\AppFramework\QueryException) { + $themesService = null; + } + + $page->assign('enabledThemes', $themesService?->getEnabledThemes() ?? []); if ($this->config->getSystemValueBool('installed', false)) { if (empty(self::$versionHash)) {