From c9bd7b737dc949aba0800029d71317814e567c0b Mon Sep 17 00:00:00 2001 From: Ben Olden-Cooligan Date: Sun, 2 Feb 2025 11:27:13 -0800 Subject: [PATCH] Fix null ref --- NAPS2.Lib.WinForms/WinForms/ToolbarFormatter.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/NAPS2.Lib.WinForms/WinForms/ToolbarFormatter.cs b/NAPS2.Lib.WinForms/WinForms/ToolbarFormatter.cs index 6bf3403a1f..593320db48 100644 --- a/NAPS2.Lib.WinForms/WinForms/ToolbarFormatter.cs +++ b/NAPS2.Lib.WinForms/WinForms/ToolbarFormatter.cs @@ -40,6 +40,7 @@ public void RelayoutToolbar(ToolStrip tStrip, float scaleFactor) // Recalculate sizes Invoker.Current.InvokeDispatch(() => { + if (tStrip.Parent == null) return; if (tStrip.Parent.Dock == DockStyle.Top || tStrip.Parent.Dock == DockStyle.Bottom) { // TODO: If we cache the used width, this check doesn't require any layout - so we can run it on form resize to see if we need to relayout