From c52daf3914d89edefac9423a16754728359532c9 Mon Sep 17 00:00:00 2001 From: Misaki Date: Sat, 28 Mar 2026 22:54:30 +0900 Subject: [PATCH] fix(docking): address code quality issues in DockingLayout --- .../Ghost.Editor/View/Controls/Docking/DockingLayout.cs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/Editor/Ghost.Editor/View/Controls/Docking/DockingLayout.cs b/src/Editor/Ghost.Editor/View/Controls/Docking/DockingLayout.cs index 88be133..fabaca1 100644 --- a/src/Editor/Ghost.Editor/View/Controls/Docking/DockingLayout.cs +++ b/src/Editor/Ghost.Editor/View/Controls/Docking/DockingLayout.cs @@ -32,6 +32,9 @@ public class DockingLayout : Control private DockRegionHighlight? _highlight; private readonly List _floatingWindows = new(); + /// + /// Initializes a new instance of the class. + /// public DockingLayout() { DefaultStyleKey = typeof(DockingLayout); @@ -127,6 +130,11 @@ public class DockingLayout : Control int index = parentPanel.Children.IndexOf(targetGroup); + if (index < 0) + { + throw new InvalidOperationException("targetGroup not found in parentPanel"); + } + if (parentPanel.Orientation == orientation) { // Same orientation, just insert @@ -248,6 +256,7 @@ public class DockingLayout : Control internal void CreateFloatingWindow(DockDocument doc) { + ArgumentNullException.ThrowIfNull(doc); var window = new FloatingWindow(doc); _floatingWindows.Add(window); window.Closed += (s, e) => _floatingWindows.Remove(window);