From c0d192a8f63d704e097eb3880e9c87617380d6f1 Mon Sep 17 00:00:00 2001 From: Rustam Sayfutdinov Date: Wed, 24 Jun 2020 23:57:56 +0500 Subject: [PATCH] Rewrite getting targetVal --- .../Animation/Animators/SolidColorBrushAnimator.cs | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/Avalonia.Visuals/Animation/Animators/SolidColorBrushAnimator.cs b/src/Avalonia.Visuals/Animation/Animators/SolidColorBrushAnimator.cs index d60542a6b4..9c8f72fe88 100644 --- a/src/Avalonia.Visuals/Animation/Animators/SolidColorBrushAnimator.cs +++ b/src/Avalonia.Visuals/Animation/Animators/SolidColorBrushAnimator.cs @@ -1,6 +1,5 @@ using System; using System.Reactive.Disposables; -using Avalonia.Logging; using Avalonia.Media; using Avalonia.Media.Immutable; @@ -39,11 +38,13 @@ namespace Avalonia.Animation.Animators } } - // Add SCB if the target prop is empty. - if (control.GetValue(Property) == null) - control.SetValue(Property, new SolidColorBrush(Colors.Transparent)); - var targetVal = control.GetValue(Property); + // Add SCB if the target prop is empty. + if (targetVal is null) + { + targetVal = new SolidColorBrush(Colors.Transparent); + control.SetValue(Property, targetVal); + } // Continue if target prop is not empty & is a SolidColorBrush derivative. if (typeof(ISolidColorBrush).IsAssignableFrom(targetVal.GetType()))