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);