From 4c7ebbc8ef3fa264483528dd840e45cd88966103 Mon Sep 17 00:00:00 2001 From: sta Date: Wed, 16 Oct 2019 20:52:40 +0900 Subject: [PATCH] [Modify] Polish it --- websocket-sharp/Net/HttpListenerResponse.cs | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/websocket-sharp/Net/HttpListenerResponse.cs b/websocket-sharp/Net/HttpListenerResponse.cs index 8ddd5b0a..2ac8a741 100644 --- a/websocket-sharp/Net/HttpListenerResponse.cs +++ b/websocket-sharp/Net/HttpListenerResponse.cs @@ -355,14 +355,19 @@ namespace WebSocketSharp.Net } set { - checkDisposed (); + if (_disposed) + throw new ObjectDisposedException (GetType ().ToString ()); + if (value == null) { _location = null; return; } - Uri uri = null; - if (!value.MaybeUri () || !Uri.TryCreate (value, UriKind.Absolute, out uri)) + if (!value.MaybeUri ()) + throw new ArgumentException ("Not an absolute URL.", "value"); + + Uri uri; + if (!Uri.TryCreate (value, UriKind.Absolute, out uri)) throw new ArgumentException ("Not an absolute URL.", "value"); _location = value;