Quick fix: Missed `null` checks in 7dc0508

This commit is contained in:
Doug Bunting 2015-05-11 22:12:28 -07:00
parent 89b5f5b1aa
commit 294fb5c3cd
2 changed files with 9 additions and 4 deletions

View File

@ -42,7 +42,8 @@ namespace Microsoft.AspNet.Razor.TagHelpers
return true; return true;
} }
return string.Equals(descriptorX.AssemblyName, descriptorY.AssemblyName, StringComparison.Ordinal) && return descriptorX != null &&
string.Equals(descriptorX.AssemblyName, descriptorY.AssemblyName, StringComparison.Ordinal) &&
string.Equals(descriptorX.TypeName, descriptorY.TypeName, StringComparison.Ordinal); string.Equals(descriptorX.TypeName, descriptorY.TypeName, StringComparison.Ordinal);
} }

View File

@ -18,9 +18,13 @@ namespace Microsoft.AspNet.Razor.Runtime.TagHelpers
public bool Equals(IReadOnlyTagHelperAttribute attributeX, IReadOnlyTagHelperAttribute attributeY) public bool Equals(IReadOnlyTagHelperAttribute attributeX, IReadOnlyTagHelperAttribute attributeY)
{ {
return if (attributeX == attributeY)
attributeX == attributeY || {
// Normal comparer doesn't care about the Name case, in tests we do. return true;
}
// Normal comparer (TagHelperAttribute.Equals()) doesn't care about the Name case, in tests we do.
return attributeX != null &&
string.Equals(attributeX.Name, attributeY.Name, StringComparison.Ordinal) && string.Equals(attributeX.Name, attributeY.Name, StringComparison.Ordinal) &&
Equals(attributeX.Value, attributeY.Value); Equals(attributeX.Value, attributeY.Value);
} }