From 503767d31e90f8e82bde54f6d17e19418e04eb1b Mon Sep 17 00:00:00 2001 From: sta Date: Sat, 22 Sep 2018 20:35:55 +0900 Subject: [PATCH] [Modify] Throw exception --- websocket-sharp/Net/HttpUtility.cs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/websocket-sharp/Net/HttpUtility.cs b/websocket-sharp/Net/HttpUtility.cs index 14c20206..0d207d77 100644 --- a/websocket-sharp/Net/HttpUtility.cs +++ b/websocket-sharp/Net/HttpUtility.cs @@ -1288,10 +1288,12 @@ namespace WebSocketSharp.Net public static string UrlEncodeUnicode (string s) { - if (s == null || s.Length == 0) - return s; + if (s == null) + 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)