windows/info_bar: Prevent UnboundLocalError. Thanks genofire

Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
This commit is contained in:
Maxime “pep” Buquet 2020-07-24 12:12:56 +02:00
parent 6ddf497e10
commit 2f60a91b80
Signed by: pep
GPG key ID: DEDA74AEECA9D0F2

View file

@ -118,6 +118,10 @@ class VerticalGlobalInfoBar(Win):
nb_tabs = len(sorted_tabs) nb_tabs = len(sorted_tabs)
use_nicks = config.get('use_tab_nicks') use_nicks = config.get('use_tab_nicks')
if nb_tabs >= height: 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): for y, tab in enumerate(sorted_tabs):
if tab.vertical_color == theme.COLOR_VERTICAL_TAB_CURRENT: if tab.vertical_color == theme.COLOR_VERTICAL_TAB_CURRENT:
pos = y pos = y