From 36b74f63ada48cd708208301d47cc4f31cf439e7 Mon Sep 17 00:00:00 2001 From: sta Date: Thu, 6 Sep 2018 19:49:42 +0900 Subject: [PATCH] [Modify] Polish it --- websocket-sharp/Net/HttpUtility.cs | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/websocket-sharp/Net/HttpUtility.cs b/websocket-sharp/Net/HttpUtility.cs index 9a20b416..b4d11470 100644 --- a/websocket-sharp/Net/HttpUtility.cs +++ b/websocket-sharp/Net/HttpUtility.cs @@ -1106,12 +1106,15 @@ namespace WebSocketSharp.Net public static string UrlEncode (byte[] bytes) { - int len; - return bytes == null - ? null - : (len = bytes.Length) == 0 - ? String.Empty - : Encoding.ASCII.GetString (InternalUrlEncodeToBytes (bytes, 0, len)); + if (bytes == null) + return null; + + var len = bytes.Length; + return len > 0 + ? Encoding.ASCII.GetString ( + InternalUrlEncodeToBytes (bytes, 0, len) + ) + : String.Empty; } public static string UrlEncode (string s)