Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/xamarin/Xamarin.PropertyEditing.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJose Medrano <josmed@microsoft.com>2022-07-21 18:34:16 +0300
committerJose Medrano <josmed@microsoft.com>2022-07-21 18:51:41 +0300
commit5964a0ee68900ef62dfa65a4150643876b2945ba (patch)
tree03831dd9502fa0947fe6c24b8c16f35709658d59
parent7c2f097d1b2690fe1aa34a29c0c3707836369478 (diff)
[HistoryLayer] On viewmodel changes we ensure our viewmodel is not null and set default color
-rw-r--r--Xamarin.PropertyEditing.Mac/Controls/Custom/HistoryLayer.cs6
1 files changed, 5 insertions, 1 deletions
diff --git a/Xamarin.PropertyEditing.Mac/Controls/Custom/HistoryLayer.cs b/Xamarin.PropertyEditing.Mac/Controls/Custom/HistoryLayer.cs
index 9f90d61..48baebb 100644
--- a/Xamarin.PropertyEditing.Mac/Controls/Custom/HistoryLayer.cs
+++ b/Xamarin.PropertyEditing.Mac/Controls/Custom/HistoryLayer.cs
@@ -78,7 +78,11 @@ namespace Xamarin.PropertyEditing.Mac
{
LayoutIfNeeded ();
current.BackgroundColor = interaction.Color.ToCGColor ();
- previous.BackgroundColor = interaction.ViewModel.InitialColor.ToCGColor ();
+ //there are some scenarios where viewmodel could be null
+ var initialColor = interaction.ViewModel?.InitialColor;
+ if (initialColor != null) {
+ previous.BackgroundColor = initialColor.ToCGColor ();
+ }
last.BackgroundColor = interaction.LastColor.ToCGColor ();
}