andrebaltieri / Flunt

Validations and Notifications
https://github.com/andrebaltieri/flunt
MIT License
624 stars 162 forks source link

Making AreEquals and AreNotEquals contracts null safe #64

Closed douglasangeli closed 3 years ago

douglasangeli commented 3 years ago

On the methods AreEquals and AreNotEqual in the class Flunt/Validations/StringValidationContract.cs there ia a little problem in a specific situation:

When the instance Equals method was called, you can get an NullReferenceException if the specified property value was null.

To avoid this behavior, I am suggesting the use of static string.Equals instead it. So null values wil be considered different without throws any unexpect exception.

andrebaltieri commented 3 years ago

Can you please provide more details on your change?

douglasangeli commented 3 years ago

updated!

andrebaltieri commented 3 years ago

@douglasangeli you rock!