From 2be657029292a4b1165accfa605ace755a7b0545 Mon Sep 17 00:00:00 2001 From: ImNotAVirus <17680522+ImNotAVirus@users.noreply.github.com> Date: Wed, 4 Oct 2023 18:55:34 +0200 Subject: [PATCH] :ambulance: Fix serialize --- lib/elven_gard/network/packet_serializer.ex | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/elven_gard/network/packet_serializer.ex b/lib/elven_gard/network/packet_serializer.ex index 78fd17b..79fd591 100644 --- a/lib/elven_gard/network/packet_serializer.ex +++ b/lib/elven_gard/network/packet_serializer.ex @@ -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 @@ -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