From 7c8a41b2b7c8e22228b259d3653db43c38f3af74 Mon Sep 17 00:00:00 2001 From: John Colvin Date: Thu, 5 Sep 2024 17:58:20 -0400 Subject: [PATCH] fix: Add null check in ComboCheckBox.SelectedItemsCollectionChanged --- .../view/Controls/ComboCheckBox/ComboCheckBox.xaml.cs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/client/spark/view/Controls/ComboCheckBox/ComboCheckBox.xaml.cs b/src/client/spark/view/Controls/ComboCheckBox/ComboCheckBox.xaml.cs index 624db6591..05c21f446 100644 --- a/src/client/spark/view/Controls/ComboCheckBox/ComboCheckBox.xaml.cs +++ b/src/client/spark/view/Controls/ComboCheckBox/ComboCheckBox.xaml.cs @@ -143,7 +143,15 @@ namespace mbts.ui.controls { case NotifyCollectionChangedAction.Replace: if (e.OldItems != null) foreach (var item in e.OldItems) _set_is_selected(item, false); if (e.NewItems != null) foreach (var item in e.NewItems) _set_is_selected(item, true); break; - case NotifyCollectionChangedAction.Reset: foreach (var item in ItemsSource) _set_is_selected(item, false); break; + case NotifyCollectionChangedAction.Reset: { + var itemsSource = ItemsSource; + if (itemsSource is not null) { + foreach (var item in itemsSource) { + _set_is_selected(item, false); + } + } + } + break; } _update_is_all_selected(); }