Merge branch 'fix/suggestions-api-error-handling' into 'develop'
[akkoma] / lib / pleroma / web / mastodon_api / mastodon_api_controller.ex
index e89cd63a2ddf67d2270af6b3456330d3242b8e97..f482de6fdc9bbd8781d6967bd103254d19f7fd0a 100644 (file)
@@ -1116,7 +1116,14 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIController do
         data2 =
           Enum.slice(data, 0, 40)
           |> Enum.map(fn x ->
-            Map.put(x, "id", User.get_or_fetch(x["acct"]).id)
+            Map.put(
+              x,
+              "id",
+              case User.get_or_fetch(x["acct"]) do
+                %{id: id} -> id
+                _ -> 0
+              end
+            )
           end)
 
         conn