From 1c238152f7e896a5edd38bbc8b16c7b3dd44cd43 Mon Sep 17 00:00:00 2001 From: Stefan Tatschner Date: Wed, 18 May 2016 16:20:03 +0200 Subject: [PATCH] Fix crash when hovering over an invalid URL --- qutebrowser/mainwindow/statusbar/url.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/qutebrowser/mainwindow/statusbar/url.py b/qutebrowser/mainwindow/statusbar/url.py index 6c01b8cfe..4d8e6e2a0 100644 --- a/qutebrowser/mainwindow/statusbar/url.py +++ b/qutebrowser/mainwindow/statusbar/url.py @@ -153,12 +153,11 @@ class UrlText(textbase.TextBase): _text: The text of the hovered link (string) """ if link: - # 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() + if qurl.isValid(): + self._hover_url = qurl.toDisplayString() + else: + self._hover_url = link else: self._hover_url = None self._update_url()