Skip to content

Commit

Permalink
fix: 🐛 fix crash on ArrayComparer.Equals
Browse files Browse the repository at this point in the history
  • Loading branch information
jasonboukheir committed Oct 29, 2021
1 parent 4d4b583 commit e2931e0
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,15 @@ public static T DeserializeMessagePack<T>(NativeArray<byte>.ReadOnly bytes)
public static void SerializeMessagePack<T>(T obj, NativeList<byte> bytes)
{
var writer = new MessagePackWriter(bytes);
AlgoApiFormatterCache<T>.Formatter.Serialize(ref writer, obj);
var formatter = AlgoApiFormatterCache<T>.Formatter;
formatter.Serialize(ref writer, obj);
}

public static void SerializeJson<T>(T obj, NativeText text)
{
var writer = new JsonWriter(text);
AlgoApiFormatterCache<T>.Formatter.Serialize(ref writer, obj);
var formatter = AlgoApiFormatterCache<T>.Formatter;
formatter.Serialize(ref writer, obj);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public static class ArrayComparer
{
public static bool Equals<T>(T[] x, T[] y) where T : IEquatable<T>
{
return ArrayComparer.Equals(x, y);
return ArrayComparer<T>.Equals(x, y);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ public struct LogicSig

public bool Equals(LogicSig other)
{
return ArrayComparer.Equals(Program, other.Program)
&& ArrayComparer.Equals(Args, other.Args)
&& Sig.Equals(other.Sig)
return Sig.Equals(other.Sig)
&& MultiSig.Equals(other.MultiSig)
&& ArrayComparer.Equals(Program, other.Program)
&& ArrayComparer.Equals(Args, other.Args)
;
}

Expand Down

0 comments on commit e2931e0

Please sign in to comment.