Skip to content

Commit

Permalink
fix: crash when detaching monitor on display settings change (#519)
Browse files Browse the repository at this point in the history
  • Loading branch information
lars-berger authored Jan 24, 2024
1 parent 8a01a54 commit 0e9b289
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions GlazeWM.Domain/Containers/Container.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,18 @@ public abstract class Container
/// </summary>
public int FocusIndex => this is RootContainer ? 0 : Parent.ChildFocusOrder.IndexOf(this);

public List<Container> SelfAndSiblings => Parent.Children;
public List<Container> SelfAndSiblings =>
this is RootContainer ? new List<Container>() { this } : Parent.Children;

public IEnumerable<Container> Siblings => Parent.Children.Where(children => children != this);
public IEnumerable<Container> Siblings =>
this is RootContainer
? Array.Empty<Container>()
: Parent.Children.Where(children => children != this);

/// <summary>
/// Index of this container amongst its siblings.
/// </summary>
public int Index => Parent.Children.IndexOf(this);
public int Index => this is RootContainer ? 0 : Parent.Children.IndexOf(this);

/// <summary>
/// Get the last focused descendant by traversing downwards.
Expand Down

0 comments on commit 0e9b289

Please sign in to comment.