HostString throws ArgumentNullException for null host (#1045)

This commit is contained in:
James Newton-King 2018-10-11 04:27:33 +13:00 committed by Chris Ross
parent 2368024490
commit f6e20a38e2
1 changed files with 6 additions and 1 deletions

View File

@ -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>
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);
}