diff options
author | Bret Johnson <bret.johnson@microsoft.com> | 2022-02-07 08:30:21 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-02-07 08:30:21 +0300 |
commit | 1768a40adf535d2fce3024e0f796415097116951 (patch) | |
tree | 159253f60c2cc5c7ee08a24e91287e39a74803cf | |
parent | 78bc24fb825b0a6af277930105f8ef8b85163e78 (diff) | |
parent | 9bf088da711d4beb5a194cb636a3bdee7ba2676c (diff) |
Merge pull request #789 from xamarin/dev/bretjohn/fix-1468252
Protect against CurrentAppearance NRE
-rw-r--r-- | Xamarin.PropertyEditing.Mac/HostResourceProvider.cs | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/Xamarin.PropertyEditing.Mac/HostResourceProvider.cs b/Xamarin.PropertyEditing.Mac/HostResourceProvider.cs index 4d42f06..dd2b224 100644 --- a/Xamarin.PropertyEditing.Mac/HostResourceProvider.cs +++ b/Xamarin.PropertyEditing.Mac/HostResourceProvider.cs @@ -39,7 +39,8 @@ namespace Xamarin.PropertyEditing.Mac public virtual NSImage GetNamedImage (string name) { - if ((CurrentAppearance ?? NSAppearance.CurrentAppearance).Name.ToLower ().Contains ("dark")) { + NSAppearance currentAppearance = CurrentAppearance ?? NSAppearance.CurrentAppearance; + if (currentAppearance != null && currentAppearance.Name.ToLower ().Contains ("dark")) { bool sel = name.EndsWith ("~sel"); if (sel) name = name.Substring (0, name.Length - 4); |