From 1ea0bb4096e5995d28e22cbd3906cd18c84f1b7f Mon Sep 17 00:00:00 2001 From: ChsBuffer <33744752+chsbuffer@users.noreply.github.com> Date: Fri, 5 Mar 2021 00:22:57 +0800 Subject: [PATCH] ignore JsonSerializer.Deserialize return value possible null --- Netch/Servers/Shadowsocks/SSUtil.cs | 2 +- Netch/Servers/VMess/VMessUtil.cs | 2 +- Netch/Utils/i18N.cs | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Netch/Servers/Shadowsocks/SSUtil.cs b/Netch/Servers/Shadowsocks/SSUtil.cs index 5526e73c..aa3a93be 100644 --- a/Netch/Servers/Shadowsocks/SSUtil.cs +++ b/Netch/Servers/Shadowsocks/SSUtil.cs @@ -76,7 +76,7 @@ namespace Netch.Servers.Shadowsocks public IEnumerable ParseSsdUri(string s) { - var json = JsonSerializer.Deserialize
(ShareLink.URLSafeBase64Decode(s.Substring(6))); + var json = JsonSerializer.Deserialize
(ShareLink.URLSafeBase64Decode(s.Substring(6)))!; return json.servers.Select(server => new Shadowsocks { diff --git a/Netch/Servers/VMess/VMessUtil.cs b/Netch/Servers/VMess/VMessUtil.cs index a57d062c..4c220563 100644 --- a/Netch/Servers/VMess/VMessUtil.cs +++ b/Netch/Servers/VMess/VMessUtil.cs @@ -97,7 +97,7 @@ namespace Netch.Servers.VMess if (data.TransferProtocol == "quic") { - if (VMessGlobal.QUIC.Contains(vmess.host)) + if (VMessGlobal.QUIC.Contains(vmess.host!)) { data.QUICSecure = vmess.host; data.QUICSecret = vmess.path; diff --git a/Netch/Utils/i18N.cs b/Netch/Utils/i18N.cs index 1ad8e74a..9062e088 100644 --- a/Netch/Utils/i18N.cs +++ b/Netch/Utils/i18N.cs @@ -57,7 +57,7 @@ namespace Netch.Utils break; } - var dictionary = JsonSerializer.Deserialize>(text); + var dictionary = JsonSerializer.Deserialize>(text)!; if (!dictionary.Any()) {