From c139a82bdf32e27f07f7de2fa00b0d204d726d44 Mon Sep 17 00:00:00 2001 From: ChsBuffer <33744752+chsbuffer@users.noreply.github.com> Date: Fri, 5 Mar 2021 14:50:25 +0800 Subject: [PATCH] Fix Remove invalid profile error Exit when Load Configuration error --- Netch/Utils/Configuration.cs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Netch/Utils/Configuration.cs b/Netch/Utils/Configuration.cs index 51efc352da..db6dd101f4 100644 --- a/Netch/Utils/Configuration.cs +++ b/Netch/Utils/Configuration.cs @@ -53,8 +53,7 @@ public static Setting ParseSetting(string text) #region Check Profile - foreach (var profile in settings.Profiles.Where(p => p.ServerRemark == string.Empty || p.ModeRemark == string.Empty)!) - settings.Profiles.Remove(profile); + settings.Profiles.RemoveAll(p => p.ServerRemark == string.Empty || p.ModeRemark == string.Empty); if (settings.Profiles.Any(p => settings.Profiles.Any(p1 => p1 != p && p1.Index == p.Index))) for (var i = 0; i < settings.Profiles.Count; i++) @@ -67,7 +66,9 @@ public static Setting ParseSetting(string text) catch (Exception e) { Logging.Error(e.ToString()); - return new Setting(); + Utils.Open(Logging.LogFile); + Environment.Exit(-1); + return null!; } }