From 3eb26f865ffa2a776b170de0c30d0acb9a6911f8 Mon Sep 17 00:00:00 2001 From: Eric Maupin Date: Wed, 6 Mar 2019 14:50:00 -0500 Subject: [mac] Fix resource selection on non-brushes Originally it was trying to use the ResourceSelector property from BrushPropertyViewModel but that's intended for a resource request, it's for the inline resource selector. In trying to do this it didn't do proper null checks for the property, so it'd crash when it inevitably wasn't found. --- .../Controls/RequestResource/RequestResourceView.cs | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) (limited to 'Xamarin.PropertyEditing.Mac/Controls/RequestResource') diff --git a/Xamarin.PropertyEditing.Mac/Controls/RequestResource/RequestResourceView.cs b/Xamarin.PropertyEditing.Mac/Controls/RequestResource/RequestResourceView.cs index 607d453..bee3e70 100644 --- a/Xamarin.PropertyEditing.Mac/Controls/RequestResource/RequestResourceView.cs +++ b/Xamarin.PropertyEditing.Mac/Controls/RequestResource/RequestResourceView.cs @@ -75,14 +75,7 @@ namespace Xamarin.PropertyEditing.Mac var vmType = propertyViewModel.GetType (); var valuePropertyInfo = vmType.GetProperty ("Value"); var resourceValue = valuePropertyInfo.GetValue (propertyViewModel); - var resourceSelectorPropertyInfo = vmType.GetProperty ("ResourceSelector"); - var resourceSelector = resourceSelectorPropertyInfo.GetValue (propertyViewModel) as ResourceSelectorViewModel; - - if (resourceSelector != null) { - this.resourceSelectorPanel = new RequestResourcePanel (HostResources, resourceSelector, resourceValue); - } else { - this.resourceSelectorPanel = new RequestResourcePanel (HostResources, new ResourceSelectorViewModel (propertyViewModel.TargetPlatform.ResourceProvider, propertyViewModel.Editors.Select (ed => ed.Target), propertyViewModel.Property), resourceValue); - } + this.resourceSelectorPanel = new RequestResourcePanel (HostResources, new ResourceSelectorViewModel (propertyViewModel.TargetPlatform.ResourceProvider, propertyViewModel.Editors.Select (ed => ed.Target), propertyViewModel.Property), resourceValue); this.resourceSelectorPanel.ResourceSelected += (sender, e) => { propertyViewModel.Resource = this.resourceSelectorPanel.SelectedResource; }; -- cgit v1.2.3