diff options
author | Eric Maupin <ermaup@microsoft.com> | 2019-09-17 22:14:06 +0300 |
---|---|---|
committer | Eric Maupin <ermaup@microsoft.com> | 2019-09-17 22:14:06 +0300 |
commit | ff21f0045edf7b95c1d39098517b2d47e197d851 (patch) | |
tree | e309128360b45d66896e6796232c89297533f458 /Xamarin.PropertyEditing.Mac | |
parent | a94977487bb8e4a7c83a795ead4c7a410c2631c7 (diff) |
[mac] Handle null TargetPlatform
Diffstat (limited to 'Xamarin.PropertyEditing.Mac')
-rw-r--r-- | Xamarin.PropertyEditing.Mac/PropertyEditorPanel.cs | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/Xamarin.PropertyEditing.Mac/PropertyEditorPanel.cs b/Xamarin.PropertyEditing.Mac/PropertyEditorPanel.cs index 850665a..7e96dde 100644 --- a/Xamarin.PropertyEditing.Mac/PropertyEditorPanel.cs +++ b/Xamarin.PropertyEditing.Mac/PropertyEditorPanel.cs @@ -96,7 +96,7 @@ namespace Xamarin.PropertyEditing.Mac } this.targetPlatform = value; - this.viewModel = new PanelViewModel (value); + this.viewModel = (value != null) ? new PanelViewModel (value) : null; this.propertyList.ViewModel = this.viewModel; OnVmPropertyChanged (this.viewModel, new PropertyChangedEventArgs (null)); @@ -232,10 +232,12 @@ namespace Xamarin.PropertyEditing.Mac private void OnVmPropertyChanged (object sender, PropertyChangedEventArgs e) { if (e.PropertyName == nameof (PanelViewModel.ArrangeMode) || String.IsNullOrEmpty (e.PropertyName)) { - int selected = this.viewModel.ArrangeModes.Select (vm => vm.ArrangeMode).IndexOf (this.viewModel.ArrangeMode); - var views = this.tabStack.Views; - for (int i = 0; i < views.Length; i++) { - ((TabButton)views[i]).Selected = (i == selected); + if (this.viewModel != null) { + int selected = this.viewModel.ArrangeModes.Select (vm => vm.ArrangeMode).IndexOf (this.viewModel.ArrangeMode); + var views = this.tabStack.Views; + for (int i = 0; i < views.Length; i++) { + ((TabButton)views[i]).Selected = (i == selected); + } } } } |