diff --git a/kitty/layout/splits.py b/kitty/layout/splits.py index ba6949546..0aad98603 100644 --- a/kitty/layout/splits.py +++ b/kitty/layout/splits.py @@ -515,9 +515,7 @@ def add_non_overlay_window( aw = next_to or all_windows.active_window if bias: bias = max(0, min(abs(bias), 100)) / 100 - if aw is not None: - ag = all_windows.active_group - assert ag is not None + if aw is not None and (ag := all_windows.group_for_window(aw)) is not None: group_id = ag.id pair = self.pairs_root.pair_for_window(group_id) if pair is not None: