Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: crash when detaching monitor on display settings change #519

Merged
merged 2 commits into from
Jan 24, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading