Ignore null elements

How does this even happen?
This commit is contained in:
Yoshi Askharoun
2024-05-12 20:08:54 -05:00
parent 513c491db2
commit fdbc472ef7
@@ -1,4 +1,5 @@
using Microsoft.Xaml.Behaviors; using Microsoft.Xaml.Behaviors;
using OwlCore.Extensions;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Collections.Specialized; using System.Collections.Specialized;
@@ -51,7 +52,7 @@ namespace ZuneModdingHelper.Behaviors
} }
items = itemsSub; items = itemsSub;
} }
foreach (var item in items) foreach (var item in items.PruneNull())
{ {
item.Opacity = 0; item.Opacity = 0;
} }
@@ -62,6 +63,8 @@ namespace ZuneModdingHelper.Behaviors
timer.Tick += (s, timerE) => timer.Tick += (s, timerE) =>
{ {
var item = enumerator.Current; var item = enumerator.Current;
if (item is null) return;
item.BeginAnimation(ListBoxItem.OpacityProperty, Animation); item.BeginAnimation(ListBoxItem.OpacityProperty, Animation);
if (!enumerator.MoveNext()) if (!enumerator.MoveNext())
{ {