From 2f60a91b805346a864a9e0ff06a75a1c02925602 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maxime=20=E2=80=9Cpep=E2=80=9D=20Buquet?= Date: Fri, 24 Jul 2020 12:12:56 +0200 Subject: windows/info_bar: Prevent UnboundLocalError. Thanks genofire MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Maxime “pep” Buquet --- poezio/windows/info_bar.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/poezio/windows/info_bar.py b/poezio/windows/info_bar.py index e94e1810..c53ed68a 100644 --- a/poezio/windows/info_bar.py +++ b/poezio/windows/info_bar.py @@ -118,6 +118,10 @@ class VerticalGlobalInfoBar(Win): nb_tabs = len(sorted_tabs) use_nicks = config.get('use_tab_nicks') if nb_tabs >= height: + # TODO: As sorted_tabs filters out gap tabs this ensures pos is + # always set, preventing UnboundLocalError. Now is this how this + # should be fixed. + pos = 0 for y, tab in enumerate(sorted_tabs): if tab.vertical_color == theme.COLOR_VERTICAL_TAB_CURRENT: pos = y -- cgit v1.2.3