From df01a1e1994cd806143a5855cb112f92c142b563 Mon Sep 17 00:00:00 2001 From: sta Date: Tue, 8 Feb 2022 19:50:19 +0900 Subject: [PATCH] [Modify] Polish it --- websocket-sharp/Ext.cs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/websocket-sharp/Ext.cs b/websocket-sharp/Ext.cs index c436b501..469b4042 100644 --- a/websocket-sharp/Ext.cs +++ b/websocket-sharp/Ext.cs @@ -1651,6 +1651,7 @@ namespace WebSocketSharp throw new ArgumentNullException ("array"); var len = array.Length; + if (len == 0) { if (startIndex != 0) throw new ArgumentOutOfRangeException ("startIndex"); @@ -1673,10 +1674,11 @@ namespace WebSocketSharp if (length == len) return array; - var subArray = new T[length]; - Array.Copy (array, startIndex, subArray, 0, length); + var ret = new T[length]; - return subArray; + Array.Copy (array, startIndex, ret, 0, length); + + return ret; } ///