fix nil tag error

This commit is contained in:
byte[] 2020-12-02 14:18:02 -05:00
parent 533fa47d47
commit 21c17855f8

View file

@ -63,9 +63,10 @@ defmodule Philomena.ArtistLinks.ArtistLink do
def validate_category(changeset) do def validate_category(changeset) do
tag = get_field(changeset, :tag) tag = get_field(changeset, :tag)
case tag.category in ["origin", "content-fanmade"] do if not is_nil(tag) and tag.category not in ["origin", "content-fanmade"] do
false -> add_error(changeset, :tag, "must be a creator tag") add_error(changeset, :tag, "must be a creator tag")
true -> changeset else
changeset
end end
end end