forked from devlooped/moq
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix NullReferenceException when passing null to a nullable argument b…
…ut trying to match it with a non-nullable IsAny. This fixes issue devlooped#90. The problem was that Matches() has to cast its input to the type parameter T in order to call the Condition function. Since T is a reference type, it does not accept nulls and throws a NullReferenceException at the site of the cast. We get around this by treating value types as a special case. If T is a value type and the input is null, it clearly doesn't match (since value types are not nullable).
- Loading branch information
Benjamin Hodgson
committed
Mar 10, 2015
1 parent
92e8ed9
commit cc45976
Showing
2 changed files
with
25 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters