diff --git a/websocket-sharp/Server/WebSocketSessionManager.cs b/websocket-sharp/Server/WebSocketSessionManager.cs index 9881cff0..211968b9 100644 --- a/websocket-sharp/Server/WebSocketSessionManager.cs +++ b/websocket-sharp/Server/WebSocketSessionManager.cs @@ -842,8 +842,12 @@ namespace WebSocketSharp.Server public void CloseSession (string id) { IWebSocketSession session; - if (TryGetSession (id, out session)) - session.Context.WebSocket.Close (); + if (!TryGetSession (id, out session)) { + var msg = "The session could not be found."; + throw new ArgumentException (msg, "id"); + } + + session.Context.WebSocket.Close (); } ///