From da0ae5dfd3600ce3dc34314e38009143116389b6 Mon Sep 17 00:00:00 2001 From: sta Date: Wed, 17 Feb 2021 21:10:15 +0900 Subject: [PATCH] [Modify] Polish it --- websocket-sharp/Net/ChunkedRequestStream.cs | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/websocket-sharp/Net/ChunkedRequestStream.cs b/websocket-sharp/Net/ChunkedRequestStream.cs index 11912dae..17a5bf2b 100644 --- a/websocket-sharp/Net/ChunkedRequestStream.cs +++ b/websocket-sharp/Net/ChunkedRequestStream.cs @@ -120,17 +120,26 @@ namespace WebSocketSharp.Net byte[] buffer, int offset, int count, AsyncCallback callback, object state ) { - if (_disposed) - throw new ObjectDisposedException (GetType ().ToString ()); + if (_disposed) { + var name = GetType ().ToString (); + + throw new ObjectDisposedException (name); + } if (buffer == null) throw new ArgumentNullException ("buffer"); - if (offset < 0) - throw new ArgumentOutOfRangeException ("offset", "A negative value."); + if (offset < 0) { + var msg = "A negative value."; - if (count < 0) - throw new ArgumentOutOfRangeException ("count", "A negative value."); + throw new ArgumentOutOfRangeException ("offset", msg); + } + + if (count < 0) { + var msg = "A negative value."; + + throw new ArgumentOutOfRangeException ("count", msg); + } var len = buffer.Length;