diff --git a/CommunityEntity.UI.cs b/CommunityEntity.UI.cs index b052f81..85fe9d0 100644 --- a/CommunityEntity.UI.cs +++ b/CommunityEntity.UI.cs @@ -1020,6 +1020,9 @@ private void BuildScrollbar(Scrollbar scrollbar, JSON.Object obj, bool vertical) static IEnumerator FadeCanvasGroup(CanvasGroup group, float to, float duration) { + if(group == null) + yield break; + float from = group.alpha; float elapsed = 0f; while (elapsed < duration) @@ -1029,11 +1032,13 @@ static IEnumerator FadeCanvasGroup(CanvasGroup group, float to, float duration) group.alpha = value; yield return null; // another fade changed the value since we set it, abort - if (group.alpha != value) + if (group == null || group.alpha != value) yield break; } - group.alpha = to; - } + + if(group != null) + group.alpha = to; + } // sets the transform to a sensible default private void FitParent(RectTransform transform){