diff options
author | Eric Maupin <ermaup@microsoft.com> | 2019-01-15 01:01:03 +0300 |
---|---|---|
committer | Eric Maupin <ermaup@microsoft.com> | 2019-02-15 20:35:53 +0300 |
commit | dcac85f184a7fce4297904358ab2099efc031da8 (patch) | |
tree | 3d783b2ad673a5c440e0b6d144dcccc80e284aeb /Xamarin.PropertyEditing.Mac/Controls/Custom | |
parent | 38ea4489eaf0b4b8975e65527ff59b35c29875de (diff) |
[mac] ViewModel is allowed to be null
Diffstat (limited to 'Xamarin.PropertyEditing.Mac/Controls/Custom')
-rw-r--r-- | Xamarin.PropertyEditing.Mac/Controls/Custom/BrushTabViewController.cs | 2 | ||||
-rw-r--r-- | Xamarin.PropertyEditing.Mac/Controls/Custom/PropertyButton.cs | 13 |
2 files changed, 8 insertions, 7 deletions
diff --git a/Xamarin.PropertyEditing.Mac/Controls/Custom/BrushTabViewController.cs b/Xamarin.PropertyEditing.Mac/Controls/Custom/BrushTabViewController.cs index dd63955..dc956e3 100644 --- a/Xamarin.PropertyEditing.Mac/Controls/Custom/BrushTabViewController.cs +++ b/Xamarin.PropertyEditing.Mac/Controls/Custom/BrushTabViewController.cs @@ -58,7 +58,7 @@ namespace Xamarin.PropertyEditing.Mac this.inhibitSelection = true; base.OnViewModelChanged (oldModel);
- var existing = new HashSet<CommonBrushType> (ViewModel?.BrushTypes?.Values ?? Array.Empty<CommonBrushType> ());
+ var existing = new HashSet<CommonBrushType> (oldModel?.BrushTypes?.Values ?? Array.Empty<CommonBrushType> ());
existing.IntersectWith (this.brushTypeTable.Keys);
var removed = new HashSet<CommonBrushType> (this.brushTypeTable.Keys);
diff --git a/Xamarin.PropertyEditing.Mac/Controls/Custom/PropertyButton.cs b/Xamarin.PropertyEditing.Mac/Controls/Custom/PropertyButton.cs index fab17c6..9846e2c 100644 --- a/Xamarin.PropertyEditing.Mac/Controls/Custom/PropertyButton.cs +++ b/Xamarin.PropertyEditing.Mac/Controls/Custom/PropertyButton.cs @@ -18,14 +18,15 @@ namespace Xamarin.PropertyEditing.Mac { get { return viewModel; } set { - if (viewModel != null) { - viewModel.PropertyChanged -= OnPropertyChanged; + if (this.viewModel != null) { + this.viewModel.PropertyChanged -= OnPropertyChanged; } - viewModel = value; - viewModel.PropertyChanged += OnPropertyChanged; - - ValueSourceChanged (viewModel.ValueSource); + this.viewModel = value; + if (this.viewModel != null) { + this.viewModel.PropertyChanged += OnPropertyChanged; + ValueSourceChanged (this.viewModel.ValueSource); + } } } |