From 3b678d16a2cef6a670b0af8ae828c1a6c615b7b3 Mon Sep 17 00:00:00 2001 From: Marc Scholten Date: Wed, 18 Nov 2020 10:18:03 +0100 Subject: [PATCH] Don't crash if setLayout has not been called in the request lifecycle --- IHP/Controller/Render.hs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/IHP/Controller/Render.hs b/IHP/Controller/Render.hs index 22ed389d2..23f8e4bab 100644 --- a/IHP/Controller/Render.hs +++ b/IHP/Controller/Render.hs @@ -44,7 +44,9 @@ renderHtml !view = do frozenContext <- Context.freeze ?context let ?context = frozenContext - let (ViewLayout layout) = Context.fromFrozenContext @ViewLayout + let layout = case Context.maybeFromFrozenContext @ViewLayout of + Just (ViewLayout layout) -> layout + Nothing -> id let boundHtml = let ?context = frozenContext in layout (ViewSupport.html ?view) pure boundHtml