From: Thurloat Date: Sun, 2 Sep 2018 23:44:37 +0000 (-0300) Subject: sloop around get_emoji/1 to check is_binary and have a fallthrough X-Git-Url: https://git.squeep.com/?a=commitdiff_plain;h=4257f784bc8e742888e978fccbab0f566c549376;p=akkoma sloop around get_emoji/1 to check is_binary and have a fallthrough default that returns empty --- diff --git a/lib/pleroma/formatter.ex b/lib/pleroma/formatter.ex index fc2c643da..e5ccc7a49 100644 --- a/lib/pleroma/formatter.ex +++ b/lib/pleroma/formatter.ex @@ -157,12 +157,12 @@ defmodule Pleroma.Formatter do end) end - def get_emoji(nil), do: [] - - def get_emoji(text) do + def get_emoji(text) when is_binary(text) do Enum.filter(@emoji, fn {emoji, _} -> String.contains?(text, ":#{emoji}:") end) end + def get_emoji(_), do: [] + def get_custom_emoji() do @emoji end