From 544d2e26c7268325fddbc58e55a912e17b60f213 Mon Sep 17 00:00:00 2001 From: Steven Kirk Date: Thu, 6 Sep 2018 20:25:49 +0200 Subject: [PATCH] Fix NRE when VirtualizingStackPanel used with ItemsControl. There is no `ScrollViewer` in the template for `ItemsControl` which means that if a `VirtualizingStackPanel` is used for `ItemsControl.ItemsPanel` then `InvalidateScroll` won't be set. Just do nothing in this case. Fixes #1829. --- src/Avalonia.Controls/Presenters/ItemVirtualizer.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Avalonia.Controls/Presenters/ItemVirtualizer.cs b/src/Avalonia.Controls/Presenters/ItemVirtualizer.cs index c5344b29d9..46da8fe3f8 100644 --- a/src/Avalonia.Controls/Presenters/ItemVirtualizer.cs +++ b/src/Avalonia.Controls/Presenters/ItemVirtualizer.cs @@ -279,6 +279,6 @@ namespace Avalonia.Controls.Presenters /// /// Invalidates the current scroll. /// - protected void InvalidateScroll() => ((ILogicalScrollable)Owner).InvalidateScroll(); + protected void InvalidateScroll() => ((ILogicalScrollable)Owner).InvalidateScroll?.Invoke(); } }