Assert that hovered link generates a valid QUrl
This commit is contained in:
parent
224c877fec
commit
959f777f92
@ -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()
|
||||||
|
Loading…
Reference in New Issue
Block a user