diff --git a/websocket-sharp/Server/WebSocketServer.cs b/websocket-sharp/Server/WebSocketServer.cs
index 73e12119..535439ec 100644
--- a/websocket-sharp/Server/WebSocketServer.cs
+++ b/websocket-sharp/Server/WebSocketServer.cs
@@ -887,17 +887,22 @@ namespace WebSocketSharp.Server
/// The type of the behavior of the service to add. The TBehavior must inherit
/// the class.
///
- public void AddWebSocketService (string path, Func initializer)
+ public void AddWebSocketService (
+ string path, Func initializer
+ )
where TBehavior : WebSocketBehavior
{
- var msg = path.CheckIfValidServicePath () ??
- (initializer == null ? "'initializer' is null." : null);
-
- if (msg != null) {
+ string msg;
+ if (!checkServicePath (path, out msg)) {
_logger.Error (msg);
return;
}
+ if (initializer == null) {
+ _logger.Error ("'initializer' is null.");
+ return;
+ }
+
_services.Add (path, initializer);
}