diff --git a/src/core/Microsoft.PowerToys.Settings.UI/ViewModels/FancyZonesViewModel.cs b/src/core/Microsoft.PowerToys.Settings.UI/ViewModels/FancyZonesViewModel.cs index 4c821a8c2c..1c64d1b0b1 100644 --- a/src/core/Microsoft.PowerToys.Settings.UI/ViewModels/FancyZonesViewModel.cs +++ b/src/core/Microsoft.PowerToys.Settings.UI/ViewModels/FancyZonesViewModel.cs @@ -465,9 +465,12 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels public void RaisePropertyChanged([CallerMemberName] string propertyName = null) { OnPropertyChanged(propertyName); - SndFancyZonesSettings outsettings = new SndFancyZonesSettings(Settings); - SndModuleSettings ipcMessage = new SndModuleSettings(outsettings); - ShellPage.DefaultSndMSGCallback(ipcMessage.ToJsonString()); + if (ShellPage.DefaultSndMSGCallback != null) + { + SndFancyZonesSettings outsettings = new SndFancyZonesSettings(Settings); + SndModuleSettings ipcMessage = new SndModuleSettings(outsettings); + ShellPage.DefaultSndMSGCallback(ipcMessage.ToJsonString()); + } } } } diff --git a/src/core/Microsoft.PowerToys.Settings.UnitTest/ViewModelTests/FancyZones.cs b/src/core/Microsoft.PowerToys.Settings.UnitTest/ViewModelTests/FancyZones.cs index f5f3b4b4d3..45e8f2b092 100644 --- a/src/core/Microsoft.PowerToys.Settings.UnitTest/ViewModelTests/FancyZones.cs +++ b/src/core/Microsoft.PowerToys.Settings.UnitTest/ViewModelTests/FancyZones.cs @@ -43,6 +43,8 @@ namespace ViewModelTests { DeleteFolder(ModuleName); } + + ShellPage.DefaultSndMSGCallback = null; } public void DeleteFolder(string powertoy)