From 959f777f924df141932c333b0fa6bdd5871da009 Mon Sep 17 00:00:00 2001 From: Panagiotis Ktistakis Date: Tue, 17 May 2016 10:28:33 +0300 Subject: [PATCH] Assert that hovered link generates a valid QUrl --- qutebrowser/mainwindow/statusbar/url.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/qutebrowser/mainwindow/statusbar/url.py b/qutebrowser/mainwindow/statusbar/url.py index b6c9cd028..6c01b8cfe 100644 --- a/qutebrowser/mainwindow/statusbar/url.py +++ b/qutebrowser/mainwindow/statusbar/url.py @@ -153,7 +153,12 @@ class UrlText(textbase.TextBase): _text: The text of the hovered link (string) """ if link: - self._hover_url = QUrl(link).toDisplayString() + # We assume that `link` is always be given in a form that generates + # a valid QUrl. If this proves to be wrong, we should probably + # check and fall back to the text version otherwise. + qurl = QUrl(link) + assert qurl.isValid(), link + self._hover_url = qurl.toDisplayString() else: self._hover_url = None self._update_url()