[Modify] Throw exception

This commit is contained in:
sta 2018-09-22 20:35:55 +09:00
parent 0aa1a544f7
commit 503767d31e

View File

@ -1288,10 +1288,12 @@ namespace WebSocketSharp.Net
public static string UrlEncodeUnicode (string s) public static string UrlEncodeUnicode (string s)
{ {
if (s == null || s.Length == 0) if (s == null)
return s; throw new ArgumentNullException ("s");
return Encoding.ASCII.GetString (InternalUrlEncodeUnicodeToBytes (s)); return s.Length > 0
? Encoding.ASCII.GetString (InternalUrlEncodeUnicodeToBytes (s))
: s;
} }
public static byte[] UrlEncodeUnicodeToBytes (string s) public static byte[] UrlEncodeUnicodeToBytes (string s)