diff --git a/qutebrowser/mainwindow/tabbedbrowser.py b/qutebrowser/mainwindow/tabbedbrowser.py index 6efec0851..e1a07146a 100644 --- a/qutebrowser/mainwindow/tabbedbrowser.py +++ b/qutebrowser/mainwindow/tabbedbrowser.py @@ -558,6 +558,11 @@ class TabbedBrowser(tabwidget.TabWidget): # closing the last tab (before quitting) or shutting down return tab = self.widget(idx) + if tab is None: + log.webview.debug("on_current_changed got called with invalid " + "index {}".format(idx)) + return + log.modes.debug("Current tab changed, focusing {!r}".format(tab)) tab.setFocus() for mode in [usertypes.KeyMode.hint, usertypes.KeyMode.insert,