From d5abfa3d0d20c292986e0be45d80dddb6cd0d475 Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Thu, 9 Jun 2016 14:42:26 +0200 Subject: [PATCH] Check if original URL is valid --- qutebrowser/browser/webview.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/qutebrowser/browser/webview.py b/qutebrowser/browser/webview.py index 9fbebf78f..36c3f508f 100644 --- a/qutebrowser/browser/webview.py +++ b/qutebrowser/browser/webview.py @@ -150,8 +150,9 @@ class WebView(QWebView): def on_initial_layout_completed(self): """Add url to history now that we have displayed something.""" history = objreg.get('web-history') - if not self._orig_url.matches(self.cur_url, - QUrl.UrlFormattingOption(0)): + no_formatting = QUrl.UrlFormattingOption(0) + if (self._orig_url.isValid() and + not self._orig_url.matches(self.cur_url, no_formatting)): # If the url of the page is different than the url of the link # originally clicked, save them both. history.add_url(self._orig_url, self.title(), hidden=True)