diff --git a/websocket-sharp/Net/HttpListener.cs b/websocket-sharp/Net/HttpListener.cs index 96b42e05..feba1a10 100644 --- a/websocket-sharp/Net/HttpListener.cs +++ b/websocket-sharp/Net/HttpListener.cs @@ -765,11 +765,18 @@ namespace WebSocketSharp.Net public HttpListenerContext GetContext () { CheckDisposed (); - if (_prefixes.Count == 0) - throw new InvalidOperationException ("The listener has no URI prefix on which listens."); - if (!_listening) - throw new InvalidOperationException ("The listener hasn't been started."); + if (_prefixes.Count == 0) { + var msg = "The listener has no URI prefix on which listens."; + + throw new InvalidOperationException (msg); + } + + if (!_listening) { + var msg = "The listener has not been started."; + + throw new InvalidOperationException (msg); + } var ares = BeginGetContext (new HttpListenerAsyncResult (null, null)); ares.InGet = true;