Fix crash when hovering over an invalid URL
This commit is contained in:
parent
dc975cfac0
commit
1c238152f7
@ -153,12 +153,11 @@ class UrlText(textbase.TextBase):
|
|||||||
_text: The text of the hovered link (string)
|
_text: The text of the hovered link (string)
|
||||||
"""
|
"""
|
||||||
if link:
|
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)
|
qurl = QUrl(link)
|
||||||
assert qurl.isValid(), link
|
if qurl.isValid():
|
||||||
self._hover_url = qurl.toDisplayString()
|
self._hover_url = qurl.toDisplayString()
|
||||||
|
else:
|
||||||
|
self._hover_url = link
|
||||||
else:
|
else:
|
||||||
self._hover_url = None
|
self._hover_url = None
|
||||||
self._update_url()
|
self._update_url()
|
||||||
|
Loading…
Reference in New Issue
Block a user