From b882f81131cc072e2b0ecf2fb40c8254efcca351 Mon Sep 17 00:00:00 2001 From: sta Date: Wed, 16 Oct 2024 20:59:46 +0900 Subject: [PATCH] [Modify] Polish it --- websocket-sharp/Net/AuthenticationResponse.cs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/websocket-sharp/Net/AuthenticationResponse.cs b/websocket-sharp/Net/AuthenticationResponse.cs index 83a18ed6..b61ebb0a 100644 --- a/websocket-sharp/Net/AuthenticationResponse.cs +++ b/websocket-sharp/Net/AuthenticationResponse.cs @@ -353,18 +353,18 @@ namespace WebSocketSharp.Net // The format is [\]:. - var i = userPass.IndexOf (':'); - var uname = userPass.Substring (0, i); - var passwd = i < userPass.Length - 1 - ? userPass.Substring (i + 1) + var idx = userPass.IndexOf (':'); + var uname = userPass.Substring (0, idx); + var passwd = idx < userPass.Length - 1 + ? userPass.Substring (idx + 1) : String.Empty; // Check if exists. - i = uname.IndexOf ('\\'); + idx = uname.IndexOf ('\\'); - if (i > -1) - uname = uname.Substring (i + 1); + if (idx > -1) + uname = uname.Substring (idx + 1); ret["username"] = uname; ret["password"] = passwd;