Fix a few

This commit is contained in:
sta 2014-02-07 19:47:00 +09:00
parent 253f8f7ddc
commit d98b041c1e
2 changed files with 6 additions and 2 deletions

View File

@ -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."

View File

@ -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;
}
}