Skip to content

Commit a1fb68b

Browse files
committed
Fix MessagePackSecurity.GetEqualityComparer<object> to not return null
Fixes #810
1 parent 1aa93e6 commit a1fb68b

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

src/MessagePack/MessagePackSecurity.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ private MessagePackSecurity()
5656
/// </summary>
5757
/// <param name="copyFrom">The template to copy from.</param>
5858
protected MessagePackSecurity(MessagePackSecurity copyFrom)
59+
: this()
5960
{
6061
if (copyFrom is null)
6162
{

tests/MessagePack.Tests/MessagePackSecurityTests.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,13 @@ public void EqualityComparer_ObjectFallback()
125125
Assert.NotEqual(eq.GetHashCode(o), eq.GetHashCode(new object()));
126126
}
127127

128+
[Fact]
129+
public void EqualityComparer_ObjectFallback_AfterCopyCtor()
130+
{
131+
var security = MessagePackSecurity.UntrustedData.WithMaximumObjectGraphDepth(15);
132+
Assert.NotNull(security.GetEqualityComparer<object>());
133+
}
134+
128135
/// <summary>
129136
/// Verifies that arbitrary other types not known to be hash safe will be rejected.
130137
/// </summary>

0 commit comments

Comments
 (0)