From 1b39d02dfa11ac53efb3a8f7668640e03a10194c Mon Sep 17 00:00:00 2001 From: Samantha Houts Date: Wed, 8 Mar 2017 02:21:15 -0800 Subject: [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 f536b47e..17b9cc88 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; } } -- cgit v1.2.3