Skip to content

Commit

Permalink
Updated lazy initialization for AssemblyNameReference.PublicKeyToken
Browse files Browse the repository at this point in the history
Intialize it to null to match pattern for the other references.
Fixes the case were the lazy initialization would break when
public_key_token was Empty<byte>.Array.
  • Loading branch information
scott-ferguson-unity committed Jan 27, 2020
1 parent 4d82dab commit 227f665
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Mono.Cecil/AssemblyNameReference.cs
Original file line number Diff line number Diff line change
Expand Up @@ -85,14 +85,14 @@ public byte [] PublicKey {
set {
public_key = value;
HasPublicKey = !public_key.IsNullOrEmpty ();
public_key_token = Empty<byte>.Array;
public_key_token = null;
full_name = null;
}
}

public byte [] PublicKeyToken {
get {
if (public_key_token.IsNullOrEmpty () && !public_key.IsNullOrEmpty ()) {
if (public_key_token == null && !public_key.IsNullOrEmpty ()) {
var hash = HashPublicKey ();
// we need the last 8 bytes in reverse order
var local_public_key_token = new byte [8];
Expand Down

0 comments on commit 227f665

Please sign in to comment.