sloop around get_emoji/1 to check is_binary and have a fallthrough
authorThurloat <thurloat@gmail.com>
Sun, 2 Sep 2018 23:44:37 +0000 (20:44 -0300)
committerThurloat <thurloat@gmail.com>
Sun, 2 Sep 2018 23:44:37 +0000 (20:44 -0300)
default that returns empty

lib/pleroma/formatter.ex

index fc2c643daef7983e221cf48dd466611740c9d6d0..e5ccc7a493cee9f60a67a12b16cda6ca709b62b6 100644 (file)
@@ -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