Return nil for nil object requests.
authorRoger Braun <roger@rogerbraun.net>
Tue, 24 Oct 2017 06:39:24 +0000 (08:39 +0200)
committerRoger Braun <roger@rogerbraun.net>
Tue, 24 Oct 2017 06:39:24 +0000 (08:39 +0200)
lib/pleroma/object.ex

index 5b51d6be340170e649c55b7e8c8d06083c9464a2..3c42c7cb5852b28d85888cde8b44a00e9dbeaca4 100644 (file)
@@ -21,6 +21,7 @@ defmodule Pleroma.Object do
     |> unique_constraint(:ap_id, name: :objects_unique_apid_index)
   end
 
+  def get_by_ap_id(nil), do: nil
   def get_by_ap_id(ap_id) do
     Repo.one(from object in Object,
       where: fragment("? @> ?", object.data, ^%{id: ap_id}))