HostString throws ArgumentNullException for null host (#1045)
This commit is contained in:
parent
2368024490
commit
f6e20a38e2
|
|
@ -35,7 +35,12 @@ namespace Microsoft.AspNetCore.Http
|
||||||
/// <param name="port">A positive, greater than 0 value representing the port in the host string.</param>
|
/// <param name="port">A positive, greater than 0 value representing the port in the host string.</param>
|
||||||
public HostString(string host, int port)
|
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);
|
throw new ArgumentOutOfRangeException(nameof(port), Resources.Exception_PortMustBeGreaterThanZero);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue