Assert that hovered link generates a valid QUrl

This commit is contained in:
Panagiotis Ktistakis 2016-05-17 10:28:33 +03:00
parent 224c877fec
commit 959f777f92

View File

@ -153,7 +153,12 @@ class UrlText(textbase.TextBase):
_text: The text of the hovered link (string) _text: The text of the hovered link (string)
""" """
if link: 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: else:
self._hover_url = None self._hover_url = None
self._update_url() self._update_url()