Skip to content

Commit 5bccec5

Browse files
committed
Used ArgumentNullException.ThrowIfNull where applicable
1 parent 1eec192 commit 5bccec5

1 file changed

Lines changed: 2 additions & 4 deletions

File tree

DnsServerCore/Dns/Security/DnsCookieValidator.cs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,7 @@ public DnsCookieValidator(DnsCookieSecretManager secretManager)
7272

7373
private static IPAddress CanonicalizeClientAddress(IPAddress clientAddress)
7474
{
75-
if (clientAddress is null)
76-
throw new ArgumentNullException(nameof(clientAddress));
75+
ArgumentNullException.ThrowIfNull(clientAddress);
7776

7877
if (clientAddress.AddressFamily != AddressFamily.InterNetwork &&
7978
clientAddress.AddressFamily != AddressFamily.InterNetworkV6)
@@ -269,8 +268,7 @@ public bool Validate(IPAddress clientAddress, EDnsCookieOptionData cookie)
269268

270269
public EDnsCookieOptionData CreateResponseCookie(IPAddress clientAddress, EDnsCookieOptionData requestCookie)
271270
{
272-
if (clientAddress is null)
273-
throw new ArgumentNullException(nameof(clientAddress));
271+
ArgumentNullException.ThrowIfNull(clientAddress);
274272

275273
if (requestCookie is null || requestCookie.ClientCookie.IsEmpty)
276274
throw new ArgumentException("Request cookie must include a client cookie.", nameof(requestCookie));

0 commit comments

Comments
 (0)