From 98e9af8b8d1cbf9f2f09734d27a8c82608d22d88 Mon Sep 17 00:00:00 2001 From: Michael Weimann Date: Sat, 14 Aug 2021 15:39:40 +0200 Subject: [PATCH] handle non-existing theme in user setting --- src/Renderer/Twig/Extensions/Globals.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/Renderer/Twig/Extensions/Globals.php b/src/Renderer/Twig/Extensions/Globals.php index b7ad9293..3ece603a 100644 --- a/src/Renderer/Twig/Extensions/Globals.php +++ b/src/Renderer/Twig/Extensions/Globals.php @@ -6,6 +6,7 @@ use Engelsystem\Helpers\Authenticator; use Engelsystem\Http\Request; use Twig\Extension\AbstractExtension as TwigExtension; use Twig\Extension\GlobalsInterface as GlobalsInterface; +use function array_key_exists; class Globals extends TwigExtension implements GlobalsInterface { @@ -46,6 +47,10 @@ class Globals extends TwigExtension implements GlobalsInterface $themeId = (int)$query; } + if (array_key_exists($themeId, $themes) === false) { + $themeId = 1; + } + $theme = $themes[$themeId]; return [