hints: Ignore invalid href's instead of crashing.

This commit is contained in:
Florian Bruhin 2014-09-15 06:54:05 +02:00
parent ad2435fa0b
commit 81aa08593b

View File

@ -393,11 +393,12 @@ class HintManager(QObject):
except KeyError:
return None
url = QUrl(text)
if not url.isValid():
return None
if url.isRelative():
if baseurl is None:
baseurl = self._context.baseurl
url = baseurl.resolved(url)
qtutils.ensure_valid(url)
return url
def _find_prevnext(self, frame, prev=False):
@ -467,7 +468,7 @@ class HintManager(QObject):
raise cmdexc.CommandError("No {} links found!".format(
"prev" if prev else "forward"))
url = self._resolve_url(elem, baseurl)
if url is None or not url.isValid():
if url is None:
raise cmdexc.CommandError("No {} links found!".format(
"prev" if prev else "forward"))
self.openurl.emit(url, newtab)