account for cases when body may be nil

This commit is contained in:
Luna D 2021-10-11 19:36:29 +02:00
parent 77e689e29a
commit 2ad2a4347f
No known key found for this signature in database
GPG key ID: 81AF416F2CC36FC8

View file

@ -16,12 +16,12 @@ defmodule PhilomenaWeb.MarkdownRenderer do
representations =
collection
|> Enum.flat_map(fn %{body: text} ->
find_images(text)
find_images(text || "")
end)
|> render_representations(conn)
Enum.map(collection, fn %{body: text} ->
Markdown.to_html(text, representations)
Markdown.to_html(text || "", representations)
end)
end