Merge pull request #18 from MGGSK/FixUIConfigSave

Fix a null reference exception in UIConfig.cs
This commit is contained in:
Dexrn ZacAttack
2025-07-19 18:41:32 -07:00
committed by GitHub

View File

@@ -112,10 +112,6 @@ public class UiConfig : IConfig
JsonSerializerOptions options = new();
options.WriteIndented = true;
File.WriteAllText(_settingsFile, JsonSerializer.Serialize(Settings, options));
/* FIXME: For some reason unknown to me, App.MainWindow is null here, but only if the Settings were generated before e.g. on first launch
* No biggy in that case as nothing has been customized yet, but depending on the reason this might cause problems.
*/
App.MainWindow.LoadSettings();
}
catch (Exception ex)
{
@@ -135,6 +131,7 @@ public class UiConfig : IConfig
property.SetValue(Settings, Convert.ChangeType(value, property.PropertyType));
Save();
App.MainWindow.LoadSettings();
}
}