Skip to content

Free, open-source Windows optimization tool for performance, privacy, and simplicity.

refactor: add initialization check to property change handler

itsfatduckd35ee72e8a86
diff --git a/optimizerDuck/UI/ViewModels/Pages/SettingsViewModel.cs b/optimizerDuck/UI/ViewModels/Pages/SettingsViewModel.cs
index 9754df9..da8afea 100644
--- a/optimizerDuck/UI/ViewModels/Pages/SettingsViewModel.cs
+++ b/optimizerDuck/UI/ViewModels/Pages/SettingsViewModel.cs
@@ -171,6 +171,7 @@ public partial class SettingsViewModel(
partial void OnSelectedCultureNameChanged(string value)
{
+ if (!_isInitialized) return;
if (string.IsNullOrEmpty(value)) return;
_ = configManager.SetAsync("app:language", value);
@@ -182,15 +183,17 @@ public partial class SettingsViewModel(
partial void OnCurrentApplicationThemeChanged(ApplicationTheme oldValue, ApplicationTheme newValue)
{
+ if (!_isInitialized) return;
ApplicationThemeManager.Apply(newValue, updateAccent: false);
_ = configManager.SetAsync("app:theme", newValue.ToString());
}
partial void OnShellTimeoutMsChanged(int value)
{
+ if (!_isInitialized) return;
if (value <= 0) return;
_ = configManager.SetAsync("optimize:shellTimeoutMs", value.ToString(CultureInfo.InvariantCulture));
}
#endregion Property Changed
-}
\ No newline at end of file
+}