From eac16ffa0c21a7ca94f700be257b31f6313520db Mon Sep 17 00:00:00 2001 From: Samantha Houts Date: Wed, 8 Mar 2017 02:21:15 -0800 Subject: [PATCH] [Android] Add null checks to ActivityIndicator (#804) --- .../Renderers/ActivityIndicatorRenderer.cs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/Xamarin.Forms.Platform.Android/Renderers/ActivityIndicatorRenderer.cs b/Xamarin.Forms.Platform.Android/Renderers/ActivityIndicatorRenderer.cs index f536b47..17b9cc8 100644 --- a/Xamarin.Forms.Platform.Android/Renderers/ActivityIndicatorRenderer.cs +++ b/Xamarin.Forms.Platform.Android/Renderers/ActivityIndicatorRenderer.cs @@ -45,16 +45,22 @@ namespace Xamarin.Forms.Platform.Android void UpdateColor() { + if (Element == null || Control == null) + return; + Color color = Element.Color; if (!color.IsDefault) - Control.IndeterminateDrawable.SetColorFilter(color.ToAndroid(), PorterDuff.Mode.SrcIn); + Control.IndeterminateDrawable?.SetColorFilter(color.ToAndroid(), PorterDuff.Mode.SrcIn); else - Control.IndeterminateDrawable.ClearColorFilter(); + Control.IndeterminateDrawable?.ClearColorFilter(); } void UpdateVisibility() { + if (Element == null || Control == null) + return; + Control.Visibility = Element.IsRunning ? ViewStates.Visible : ViewStates.Invisible; } } -- 2.7.4