Throw exception if ThreadCount negative

This commit is contained in:
Ben Adams 2015-09-10 08:03:42 +01:00
parent 887cf2c7be
commit dda5774a8b
1 changed files with 8 additions and 1 deletions

View File

@ -55,7 +55,14 @@ namespace Microsoft.AspNet.Server.Kestrel
disposables.Push(engine);
engine.Start(information.ThreadCount <= 0 ? 1 : information.ThreadCount);
if (information.ThreadCount < 0)
{
throw new ArgumentOutOfRangeException(nameof(information.ThreadCount),
information.ThreadCount,
"ThreadCount cannot be negative");
}
engine.Start(information.ThreadCount == 0 ? 1 : information.ThreadCount);
foreach (var address in information.Addresses)
{