diff --git a/src/modules/AdvancedPaste/AdvancedPaste/AdvancedPasteXAML/App.xaml.cs b/src/modules/AdvancedPaste/AdvancedPaste/AdvancedPasteXAML/App.xaml.cs index 327558ad9fa9..3ac3baa9d0e6 100644 --- a/src/modules/AdvancedPaste/AdvancedPaste/AdvancedPasteXAML/App.xaml.cs +++ b/src/modules/AdvancedPaste/AdvancedPaste/AdvancedPasteXAML/App.xaml.cs @@ -263,7 +263,7 @@ protected virtual void Dispose(bool disposing) if (disposing) { EtwTrace?.Dispose(); - window.Dispose(); + window?.Dispose(); } disposedValue = true; diff --git a/src/modules/AdvancedPaste/AdvancedPaste/Helpers/UserSettings.cs b/src/modules/AdvancedPaste/AdvancedPaste/Helpers/UserSettings.cs index e2c2e07c843d..8d5f51314db5 100644 --- a/src/modules/AdvancedPaste/AdvancedPaste/Helpers/UserSettings.cs +++ b/src/modules/AdvancedPaste/AdvancedPaste/Helpers/UserSettings.cs @@ -154,8 +154,8 @@ private void Dispose(bool disposing) { if (disposing) { - _cancellationTokenSource.Dispose(); - _watcher.Dispose(); + _cancellationTokenSource?.Dispose(); + _watcher?.Dispose(); } _disposedValue = true;