From 9209f4c4163ce7db6c35cfa7ee190941ce45d721 Mon Sep 17 00:00:00 2001 From: sta Date: Mon, 27 May 2019 21:58:48 +0900 Subject: [PATCH] [Modify] Use the try method --- websocket-sharp/Net/CookieCollection.cs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/websocket-sharp/Net/CookieCollection.cs b/websocket-sharp/Net/CookieCollection.cs index 7ba652b4..8ebfb48c 100644 --- a/websocket-sharp/Net/CookieCollection.cs +++ b/websocket-sharp/Net/CookieCollection.cs @@ -290,7 +290,14 @@ namespace WebSocketSharp.Net : String.Empty; if (name.Equals ("$version", caseInsensitive)) { - ver = val.Length > 0 ? Int32.Parse (val.Unquote ()) : 0; + if (val.Length == 0) + continue; + + int num; + if (!Int32.TryParse (val.Unquote (), out num)) + continue; + + ver = num; continue; }