diff --git a/GlazeWM.Domain/Containers/Container.cs b/GlazeWM.Domain/Containers/Container.cs index c9fe480b4..bf72b2486 100644 --- a/GlazeWM.Domain/Containers/Container.cs +++ b/GlazeWM.Domain/Containers/Container.cs @@ -41,14 +41,18 @@ public abstract class Container /// public int FocusIndex => this is RootContainer ? 0 : Parent.ChildFocusOrder.IndexOf(this); - public List SelfAndSiblings => Parent.Children; + public List SelfAndSiblings => + this is RootContainer ? new List() { this } : Parent.Children; - public IEnumerable Siblings => Parent.Children.Where(children => children != this); + public IEnumerable Siblings => + this is RootContainer + ? Array.Empty() + : Parent.Children.Where(children => children != this); /// /// Index of this container amongst its siblings. /// - public int Index => Parent.Children.IndexOf(this); + public int Index => this is RootContainer ? 0 : Parent.Children.IndexOf(this); /// /// Get the last focused descendant by traversing downwards.