Skip to content

Commit

Permalink
Fix null reference when restarting listener
Browse files Browse the repository at this point in the history
  • Loading branch information
versx committed Jan 11, 2022
1 parent 0d14987 commit 1d732ca
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/Net/HttpServer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -224,8 +224,13 @@ public void Stop()

private void RequestHandler()
{
while (_server.IsListening)
while (true)
{
if (_server == null)
{
Thread.Sleep(10);
continue;
}
var contextAsyncResult = _server.BeginGetContext((IAsyncResult ar) =>
{
var context = _server.EndGetContext(ar);
Expand Down

0 comments on commit 1d732ca

Please sign in to comment.