Skip to content

Commit

Permalink
Merge pull request #555 from digitallyinduced/dont-crash-if-layout-no…
Browse files Browse the repository at this point in the history
…t-defined

Don't crash if setLayout has not been called in the request lifecycle
  • Loading branch information
mpscholten authored Nov 18, 2020
2 parents 1e67bc7 + 3b678d1 commit 51fccee
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 51fccee

Please sign in to comment.