From 85dc704cc68be743acb796ac6e5a89812f3f16b8 Mon Sep 17 00:00:00 2001 From: sta Date: Sun, 28 Jun 2015 16:59:39 +0900 Subject: [PATCH] Refactored a few for Ext.cs --- websocket-sharp/Ext.cs | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/websocket-sharp/Ext.cs b/websocket-sharp/Ext.cs index 5f3689de..e1afb2f1 100644 --- a/websocket-sharp/Ext.cs +++ b/websocket-sharp/Ext.cs @@ -808,22 +808,24 @@ namespace WebSocketSharp } /// - /// Tries to create a for WebSocket with the specified - /// . + /// Tries to create a for WebSocket with + /// the specified . /// /// /// true if a is successfully created; otherwise, false. /// /// - /// A that represents the WebSocket URL to try. + /// A that represents a WebSocket URL to try. /// /// - /// When this method returns, a that represents the WebSocket URL - /// if is valid; otherwise, . + /// When this method returns, a that represents + /// a WebSocket URL if is valid; + /// otherwise, . /// /// - /// When this method returns, a that represents the error message - /// if is invalid; otherwise, . + /// When this method returns, a that represents + /// an error message if is invalid; + /// otherwise, . /// internal static bool TryCreateWebSocketUri ( this string uriString, out Uri result, out string message) @@ -831,7 +833,7 @@ namespace WebSocketSharp result = null; var uri = uriString.ToUri (); - if (!uri.IsAbsoluteUri) { + if (uri == null || !uri.IsAbsoluteUri) { message = "Not an absolute URI: " + uriString; return false; } @@ -1719,11 +1721,11 @@ namespace WebSocketSharp /// public static Uri ToUri (this string uriString) { - Uri res; - return Uri.TryCreate ( - uriString, uriString.MaybeUri () ? UriKind.Absolute : UriKind.Relative, out res) - ? res - : null; + Uri ret; + Uri.TryCreate ( + uriString, uriString.MaybeUri () ? UriKind.Absolute : UriKind.Relative, out ret); + + return ret; } ///