From 29d1c0d68b48608ba577873935dd9751d5bd3548 Mon Sep 17 00:00:00 2001 From: thuck Date: Sun, 6 Nov 2016 23:27:06 +0100 Subject: [PATCH] Small fix for situations where we cannot find the tab for the index Need to investigate better why and when this is excatly happening --- qutebrowser/mainwindow/tabwidget.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/qutebrowser/mainwindow/tabwidget.py b/qutebrowser/mainwindow/tabwidget.py index be77f3631..4f1d45842 100644 --- a/qutebrowser/mainwindow/tabwidget.py +++ b/qutebrowser/mainwindow/tabwidget.py @@ -446,11 +446,14 @@ class TabBar(QTabBar): size = minimum_size else: #TODO: relative size and/or configured one - tab = objreg.get('tab', scope='tab', window=self._win_id, tab=index) - if tab.pin is True: - size = QSize(40, height) - qtutils.ensure_valid(size) - return size + try: + tab = objreg.get('tab', scope='tab', window=self._win_id, tab=index) + if tab.pin is True: + size = QSize(40, height) + qtutils.ensure_valid(size) + return size + except KeyError: + pass # If we *do* have enough space, tabs should occupy the whole window # width. #looks like this generates high cpu usage