Skip to content

Commit

Permalink
Don't crash if setLayout has not been called in the request lifecycle
Browse files Browse the repository at this point in the history
  • Loading branch information
mpscholten committed Nov 18, 2020
1 parent 3147eca commit 3b678d1
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion IHP/Controller/Render.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 3b678d1

Please sign in to comment.