diff options
author | Jose Medrano <josmed@microsoft.com> | 2022-07-21 18:34:16 +0300 |
---|---|---|
committer | Jose Medrano <josmed@microsoft.com> | 2022-07-21 18:51:41 +0300 |
commit | 5964a0ee68900ef62dfa65a4150643876b2945ba (patch) | |
tree | 03831dd9502fa0947fe6c24b8c16f35709658d59 | |
parent | 7c2f097d1b2690fe1aa34a29c0c3707836369478 (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.cs | 6 |
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 (); } |