From d98b041c1e67b2a0450bcebd4244f4a7986b4aea Mon Sep 17 00:00:00 2001 From: sta Date: Fri, 7 Feb 2014 19:47:00 +0900 Subject: [PATCH] Fix a few --- websocket-sharp/Ext.cs | 3 ++- websocket-sharp/Server/WebSocketService.cs | 5 ++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/websocket-sharp/Ext.cs b/websocket-sharp/Ext.cs index 479a3adb..a5495b58 100644 --- a/websocket-sharp/Ext.cs +++ b/websocket-sharp/Ext.cs @@ -261,7 +261,8 @@ namespace WebSocketSharp internal static string CheckIfValidProtocols (this string [] protocols) { return protocols.Contains ( - protocol => protocol.Length == 0 || !protocol.IsToken ()) + protocol => + protocol == null || protocol.Length == 0 || !protocol.IsToken ()) ? "Contains an invalid value." : protocols.ContainsTwice () ? "Contains a value twice." diff --git a/websocket-sharp/Server/WebSocketService.cs b/websocket-sharp/Server/WebSocketService.cs index 41c3c076..859f8bc5 100644 --- a/websocket-sharp/Server/WebSocketService.cs +++ b/websocket-sharp/Server/WebSocketService.cs @@ -157,7 +157,10 @@ namespace WebSocketSharp.Server } set { - if (State == WebSocketState.CONNECTING && value.IsToken ()) + if (State == WebSocketState.CONNECTING && + value != null && + value.Length > 0 && + value.IsToken ()) _protocol = value; } }