From f3a8a108ce08d27fbfecb324ef7ab681e9ba1ef0 Mon Sep 17 00:00:00 2001 From: status102 <102887808+status102@users.noreply.github.com> Date: Wed, 8 Jul 2026 14:19:39 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E9=A6=96=E6=AC=A1=E8=BF=90=E8=A1=8C?= =?UTF-8?q?=E6=97=B6=E9=94=99=E8=AF=AF=E5=BC=B9=E5=87=BA=E7=9B=AE=E6=A0=87?= =?UTF-8?q?=E9=85=8D=E7=BD=AE=E7=BC=BA=E5=A4=B1=E7=9A=84=E6=8F=90=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/MaaWpfGui/Configuration/Factory/ConfigFactory.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/MaaWpfGui/Configuration/Factory/ConfigFactory.cs b/src/MaaWpfGui/Configuration/Factory/ConfigFactory.cs index 202a0c654a..b2844aff85 100644 --- a/src/MaaWpfGui/Configuration/Factory/ConfigFactory.cs +++ b/src/MaaWpfGui/Configuration/Factory/ConfigFactory.cs @@ -120,6 +120,7 @@ public static class ConfigFactory { _logger.Information("Failed to load configuration file, creating a new one"); parsed = new Root(); + parsed.Configurations.Add(parsed.Current, new SpecificConfig()); } parsed.PropertyChanged += OnPropertyChangedFactory("Root."); @@ -171,6 +172,7 @@ public static class ConfigFactory _logger.Warning("{File} save failed", _configBakFile); } + // 检查当前配置是否存在,如果不存在则补上新的配置 if (parsed.Configurations.All(i => i.Key != parsed.Current)) { _brokenConfigs.Add(parsed.Current);