Skip to content

Commit

Permalink
Fix Remove invalid profile error
Browse files Browse the repository at this point in the history
Exit when Load Configuration error
  • Loading branch information
chsbuffer committed Mar 5, 2021
1 parent 97f6d60 commit c139a82
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions Netch/Utils/Configuration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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++)
Expand All @@ -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!;
}
}

Expand Down

0 comments on commit c139a82

Please sign in to comment.