Skip to content

Commit

Permalink
don't crash if fields is not a keyword
Browse files Browse the repository at this point in the history
  • Loading branch information
lukaszsamson committed Oct 30, 2023
1 parent 8cb847e commit 861f7d4
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/elixir_sense/providers/suggestion/reducers/struct.ex
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,11 @@ defmodule ElixirSense.Providers.Suggestion.Reducers.Struct do
end

defp get_fields_from_struct_spec({:"::", _, [_, {:%, _meta1, [_mod, {:%{}, _meta2, fields}]}]}) do
Map.new(fields)
if Keyword.keyword?(fields) do
Map.new(fields)
else
%{}
end
end

defp get_fields_from_struct_spec(_), do: %{}
Expand Down

0 comments on commit 861f7d4

Please sign in to comment.