Skip to content

Commit

Permalink
🚑 Fix serialize
Browse files Browse the repository at this point in the history
  • Loading branch information
ImNotAVirus committed Oct 4, 2023
1 parent 9b23d71 commit 2be6570
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/elven_gard/network/packet_serializer.ex
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ defmodule ElvenGard.Network.PacketSerializer do
case Keyword.get(opts, :if) do
nil ->
quote location: :keep do
case {Map.fetch!(var!(packet), unquote(name)), opts[:default]} do
case {Map.fetch!(var!(packet), unquote(name)), unquote(opts)[:default]} do
{nil, value} when not is_nil(value) -> value
{value, _} -> unquote(type).encode(value, unquote(opts))
end
Expand All @@ -235,7 +235,7 @@ defmodule ElvenGard.Network.PacketSerializer do
if unquote(condition) in [nil, false] do
:"$drop"
else
case {Map.fetch!(var!(packet), unquote(name)), opts[:default]} do
case {Map.fetch!(var!(packet), unquote(name)), unquote(opts)[:default]} do
{nil, value} when not is_nil(value) -> value
{value, _} -> unquote(type).encode(value, unquote(opts))
end
Expand Down

0 comments on commit 2be6570

Please sign in to comment.