Skip to content

GlazeWM is a tiling window manager for macOS and Windows inspired by i3wm.

fix: crash when `cursor_follows_cursor` is enabled (#322)

blam806f389b21d5
diff --git a/GlazeWM.Domain/Containers/CommandHandlers/CenterCursorOnContainerHandler.cs b/GlazeWM.Domain/Containers/CommandHandlers/CenterCursorOnContainerHandler.cs
index e3f11e83..28b347b2 100644
--- a/GlazeWM.Domain/Containers/CommandHandlers/CenterCursorOnContainerHandler.cs
+++ b/GlazeWM.Domain/Containers/CommandHandlers/CenterCursorOnContainerHandler.cs
@@ -18,10 +18,7 @@ namespace GlazeWM.Domain.Containers.CommandHandlers
{
var isEnabled = _userConfigService.GeneralConfig.CursorFollowsFocus;
- if (!isEnabled || command.TargetContainer == null)
- return CommandResponse.Ok;
-
- if (command.TargetContainer.IsDetached())
+ if (!isEnabled || command.TargetContainer.IsDetached() || command.TargetContainer.FocusIndex < 0)
return CommandResponse.Ok;
var targetRect = command.TargetContainer.ToRect();