Skip to content

Commit 855a193

Browse files
authored
Backport RemoveIcons NRE fix
1 parent dd8ed9c commit 855a193

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/Avalonia.Controls/TrayIcon.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,8 @@ private static void Lifetime_Exit(object sender, ControlledApplicationLifetimeEx
199199

200200
private static void Icons_CollectionChanged(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e)
201201
{
202-
RemoveIcons(e.OldItems.Cast<TrayIcon>());
202+
if (e.OldItems is not null)
203+
RemoveIcons(e.OldItems.Cast<TrayIcon>());
203204
}
204205

205206
private static void RemoveIcons(IEnumerable<TrayIcon> icons)

0 commit comments

Comments
 (0)