Skip to content
Permalink
Browse files

[Misc] Exception prone basic functions

  • Loading branch information
Eideren authored and xen2 committed May 19, 2019
1 parent 582915a commit e024d327a71369fbcc1151ee145dd9ca18799fd7
@@ -17,13 +17,12 @@ public PipelineStateDescriptionWithHash(PipelineStateDescription state)

public bool Equals(PipelineStateDescriptionWithHash other)
{
return Hash == other.Hash && State.Equals(other.State);
return Hash == other.Hash && (State == null) == (other.State == null) && (State?.Equals(other.State) ?? true);
}

public override bool Equals(object obj)
{
if (ReferenceEquals(null, obj)) return false;
return obj is PipelineStateDescriptionWithHash && Equals((PipelineStateDescriptionWithHash)obj);
return obj is PipelineStateDescriptionWithHash other && Equals(other);
}

public override int GetHashCode()
@@ -88,8 +88,8 @@ public override int GetHashCode()
{
unchecked
{
var result = ColliderA.GetHashCode();
result = (result * 397) ^ ColliderB.GetHashCode();
var result = ColliderA?.GetHashCode() ?? 0;
result = (result * 397) ^ (ColliderB?.GetHashCode() ?? 0);
return result;
}
}

0 comments on commit e024d32

Please sign in to comment.
You can’t perform that action at this time.