diff --git a/lib/service/formatter/html.ex b/lib/service/formatter/html.ex
index 67948d030..79a1f500c 100644
--- a/lib/service/formatter/html.ex
+++ b/lib/service/formatter/html.ex
@@ -41,7 +41,9 @@ defmodule Mobilizon.Service.Formatter.HTML do
def strip_tags_and_insert_spaces(html), do: html
- @spec html_to_text(String.t()) :: String.t()
+ @spec html_to_text(String.t() | nil) :: String.t() | nil
+ def html_to_text(nil), do: nil
+
def html_to_text(html) do
html
|> String.replace(~r/
/, "\\g{1}- ", global: true)
diff --git a/test/service/export/icalendar_test.exs b/test/service/export/icalendar_test.exs
index eca1451e3..0b0361577 100644
--- a/test/service/export/icalendar_test.exs
+++ b/test/service/export/icalendar_test.exs
@@ -44,11 +44,13 @@ defmodule Mobilizon.Service.ICalendarTest do
%Event{} = event = insert(:event, title: "I'm public")
%Event{} = event2 = insert(:event, visibility: :private, title: "I'm private")
%Event{} = event3 = insert(:event, title: "Another public")
+ %Event{} = event4 = insert(:event, title: "No description", description: nil)
{:commit, ics} = ICalendarService.create_cache("instance")
assert ics =~ event.title
refute ics =~ event2.title
assert ics =~ event3.title
+ assert ics =~ event4.title
end
test "with 50 events" do