From c40ff94395bd18206fc1e1403ab961d33e052511 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Fri, 10 Oct 2025 12:39:09 +0530 Subject: [PATCH] Fix error when trying to serialize a tab without any windows --- kitty/tabs.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/kitty/tabs.py b/kitty/tabs.py index cc9057d6c..f7d4b9bb2 100644 --- a/kitty/tabs.py +++ b/kitty/tabs.py @@ -324,9 +324,11 @@ class Tab: # {{{ if session_base_dir and ser_opts.relocatable: cwd = os.path.relpath(cwd, session_base_dir) return cwd + most_common_cwd = '' cwds = {w.id: make_relative(w.cwd_for_serialization) for g in groups for w in g} - from collections import Counter - most_common_cwd, _ = Counter(cwds.values()).most_common(1)[0] + if cwds: + from collections import Counter + most_common_cwd, _ = Counter(cwds.values()).most_common(1)[0] for i, g in enumerate(groups): gw: list[str] = [] for window in g: