From a1a3579b95381c77e251ac5afe7ef21ca8d9de65 Mon Sep 17 00:00:00 2001 From: James Newton-King Date: Wed, 10 Oct 2018 18:14:26 +1300 Subject: [PATCH] HostString throws ArgumentNullException for null host --- src/Microsoft.AspNetCore.Http.Abstractions/HostString.cs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/Microsoft.AspNetCore.Http.Abstractions/HostString.cs b/src/Microsoft.AspNetCore.Http.Abstractions/HostString.cs index 9496b26b..7851659b 100644 --- a/src/Microsoft.AspNetCore.Http.Abstractions/HostString.cs +++ b/src/Microsoft.AspNetCore.Http.Abstractions/HostString.cs @@ -35,7 +35,12 @@ public HostString(string value) /// A positive, greater than 0 value representing the port in the host string. public HostString(string host, int port) { - if(port <= 0) + if (host == null) + { + throw new ArgumentNullException(nameof(host)); + } + + if (port <= 0) { throw new ArgumentOutOfRangeException(nameof(port), Resources.Exception_PortMustBeGreaterThanZero); }