improvement: handle the case where fields is nil

This commit is contained in:
Zach Daniel 2022-01-19 16:34:45 -05:00
parent 3f866f3398
commit 3b1a8eaef1

View file

@ -683,7 +683,7 @@ defmodule AshJsonApiWrapper.DataLayer do
end
defp get_field(resource, endpoint, field) do
Enum.find(endpoint.fields, &(&1.name == field)) ||
Enum.find(endpoint.fields || [], &(&1.name == field)) ||
Enum.find(AshJsonApiWrapper.fields(resource), &(&1.name == field))
end
end