Skip to content

Commit 515ca62

Browse files
Merge pull request #18 from MGGSK/FixUIConfigSave
Fix a null reference exception in UIConfig.cs
2 parents 2f333a6 + d42dcc6 commit 515ca62

1 file changed

Lines changed: 1 addition & 4 deletions

File tree

Settings/UiConfig.cs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -112,10 +112,6 @@ public void Save()
112112
JsonSerializerOptions options = new();
113113
options.WriteIndented = true;
114114
File.WriteAllText(_settingsFile, JsonSerializer.Serialize(Settings, options));
115-
/* 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
116-
* No biggy in that case as nothing has been customized yet, but depending on the reason this might cause problems.
117-
*/
118-
App.MainWindow.LoadSettings();
119115
}
120116
catch (Exception ex)
121117
{
@@ -135,6 +131,7 @@ public void Set(string setting, object value)
135131

136132
property.SetValue(Settings, Convert.ChangeType(value, property.PropertyType));
137133
Save();
134+
App.MainWindow.LoadSettings();
138135
}
139136

140137
}

0 commit comments

Comments
 (0)