From f3e2a42c29778f242e098e4fad940f6df00789ed Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Tue, 16 Mar 2021 20:59:54 +0530 Subject: [PATCH] Fix #3400 --- kitty/tabs.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/kitty/tabs.py b/kitty/tabs.py index 37e3548c3..ca2f0f445 100644 --- a/kitty/tabs.py +++ b/kitty/tabs.py @@ -745,7 +745,10 @@ class TabManager: # {{{ def remove(self, tab: Tab) -> None: self._remove_tab(tab) - active_tab_needs_to_change = self.active_tab is None or self.active_tab is tab + try: + active_tab_needs_to_change = self.active_tab is None or self.active_tab is tab + except IndexError: + active_tab_needs_to_change = True while True: try: self.active_tab_history.remove(tab.id)