Skip to content

Commit

Permalink
InjectionConsumerInfo.Equals could throw null ref ex. Fixes #693.
Browse files Browse the repository at this point in the history
  • Loading branch information
dotnetjunkie committed Apr 26, 2019
1 parent 697c628 commit 6af294e
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/SimpleInjector/InjectionConsumerInfo.cs
Expand Up @@ -89,11 +89,12 @@ public Type ServiceType
this.ImplementationType.GetHashCode() ^ this.Target.GetHashCode();

/// <inheritdoc />
public override bool Equals(object obj) => this.Equals(obj as InjectionConsumerInfo);
public override bool Equals(object obj) => obj is InjectionConsumerInfo info && this.Equals(info);

/// <inheritdoc />
public bool Equals(InjectionConsumerInfo other) =>
this.ImplementationType.Equals(other.ImplementationType)
other != null
&& this.ImplementationType.Equals(other.ImplementationType)
&& this.Target.Equals(other.Target);

/// <inheritdoc />
Expand Down

0 comments on commit 6af294e

Please sign in to comment.