diff --git a/plugins/VoiceAttack-base/SettingsDialog.xaml.cs b/plugins/VoiceAttack-base/SettingsDialog.xaml.cs index 71ef16c..1fe51b2 100644 --- a/plugins/VoiceAttack-base/SettingsDialog.xaml.cs +++ b/plugins/VoiceAttack-base/SettingsDialog.xaml.cs @@ -94,6 +94,8 @@ namespace alterNERDtive private void okButton_Click(object sender, RoutedEventArgs reargs) { + bool error = false; + foreach (Setting setting in values) { dynamic state = null; @@ -130,14 +132,18 @@ namespace alterNERDtive log.Log($@"Configuration changed via settings dialog: ""{setting.Profile}.{setting.Option.Name}"" → ""{state}""", util.LogLevel.DEBUG); config.SetConfig(setting.Profile, setting.Option.Name, state); } - - Window.GetWindow(this).Close(); } catch (Exception e) when (e is ArgumentNullException || e is FormatException || e is OverflowException) { log.Log($@"Invalid value for ""{setting.Profile}.{setting.Option.Name}"": ""{((TextBox)setting.UiElement).Text}""", util.LogLevel.ERROR); + error = true; } } + + if (!error) + { + Window.GetWindow(this).Close(); + } } } }