Add argument null check (#42)

This commit is contained in:
Oliver Booth 2022-04-30 10:35:21 +01:00
parent 2547d4a227
commit e757ce08a0
No known key found for this signature in database
GPG Key ID: 32A00B35503AF634
1 changed files with 21 additions and 1 deletions

View File

@ -1,4 +1,4 @@
using System.Diagnostics.Contracts; using System.Diagnostics.Contracts;
using System.Web; using System.Web;
namespace X10D.Collections; namespace X10D.Collections;
@ -226,6 +226,11 @@ public static class DictionaryExtensions
throw new ArgumentNullException(nameof(source)); throw new ArgumentNullException(nameof(source));
} }
if (selector is null)
{
throw new ArgumentNullException(nameof(selector));
}
static string SanitizeValue(string? value) static string SanitizeValue(string? value)
{ {
if (value is null) if (value is null)
@ -268,6 +273,16 @@ public static class DictionaryExtensions
throw new ArgumentNullException(nameof(source)); throw new ArgumentNullException(nameof(source));
} }
if (keySelector is null)
{
throw new ArgumentNullException(nameof(keySelector));
}
if (valueSelector is null)
{
throw new ArgumentNullException(nameof(valueSelector));
}
static string SanitizeValue(string? value) static string SanitizeValue(string? value)
{ {
if (value is null) if (value is null)
@ -371,6 +386,11 @@ public static class DictionaryExtensions
throw new ArgumentNullException(nameof(source)); throw new ArgumentNullException(nameof(source));
} }
if (keySelector is null)
{
throw new ArgumentNullException(nameof(keySelector));
}
if (valueSelector is null) if (valueSelector is null)
{ {
throw new ArgumentNullException(nameof(valueSelector)); throw new ArgumentNullException(nameof(valueSelector));