Skip to content

Commit

Permalink
Merge pull request #811 from AArnott/fixNullHasher
Browse files Browse the repository at this point in the history
Fix `MessagePackSecurity.GetEqualityComparer<object>` to not return null
  • Loading branch information
AArnott authored Feb 10, 2020
2 parents 4187f84 + a47f350 commit f886840
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ private MessagePackSecurity()
/// </summary>
/// <param name="copyFrom">The template to copy from.</param>
protected MessagePackSecurity(MessagePackSecurity copyFrom)
: this()
{
if (copyFrom is null)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,13 @@ public void EqualityComparer_ObjectFallback()
Assert.NotEqual(eq.GetHashCode(o), eq.GetHashCode(new object()));
}

[Fact]
public void EqualityComparer_ObjectFallback_AfterCopyCtor()
{
var security = MessagePackSecurity.UntrustedData.WithMaximumObjectGraphDepth(15);
Assert.NotNull(security.GetEqualityComparer<object>());
}

/// <summary>
/// Verifies that arbitrary other types not known to be hash safe will be rejected.
/// </summary>
Expand Down

0 comments on commit f886840

Please sign in to comment.