From b59a56921e5ce2df1b2a7d68045529765c693ac6 Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Mon, 9 Nov 2015 07:46:22 +0100 Subject: [PATCH] Fix crashes with downloads in a closed tab. When a download was redirected or failed after a tab was closed, there was a KeyError in the object registry. Fixes #889. This is a regression introduced in 976f758da1d5ad086bc539b41a3afd534e64b282 / #731. --- qutebrowser/browser/network/networkmanager.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/qutebrowser/browser/network/networkmanager.py b/qutebrowser/browser/network/networkmanager.py index 897049b6c..436db914e 100644 --- a/qutebrowser/browser/network/networkmanager.py +++ b/qutebrowser/browser/network/networkmanager.py @@ -363,9 +363,14 @@ class NetworkManager(QNetworkAccessManager): if self._tab_id is None: current_url = QUrl() # generic NetworkManager, e.g. for downloads else: - webview = objreg.get('webview', scope='tab', window=self._win_id, - tab=self._tab_id) - current_url = webview.url() + try: + webview = objreg.get('webview', scope='tab', + window=self._win_id, tab=self._tab_id) + except KeyError: + # https://github.com/The-Compiler/qutebrowser/issues/889 + current_url = QUrl() + else: + current_url = webview.url() self.set_referer(req, current_url)