mirror of
https://github.com/WinDurango/WinDurango.UI.git
synced 2026-01-31 00:55:24 +01:00
Merge pull request #18 from MGGSK/FixUIConfigSave
Fix a null reference exception in UIConfig.cs
This commit is contained in:
@@ -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();
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user