From 1fb0c73e91337e81495ecd773dd502743f831763 Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Thu, 16 May 2013 14:47:42 +0900 Subject: [PATCH] fix crash on linux when pasting invalid url (#858) --- aqt/editor.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/aqt/editor.py b/aqt/editor.py index a4ac40417..71befca4e 100644 --- a/aqt/editor.py +++ b/aqt/editor.py @@ -1024,7 +1024,8 @@ class EditorWebView(AnkiWebView): url = url.splitlines()[0] link = self._localizedMediaLink(url) mime = QMimeData() - mime.setHtml(link) + if link: + mime.setHtml(link) return mime def _localizedMediaLink(self, url): @@ -1043,6 +1044,8 @@ class EditorWebView(AnkiWebView): if l.startswith("http://") or l.startswith("https://") or l.startswith("file://"): txt = txt.split("\r\n")[0] html = self._localizedMediaLink(txt) + if not html: + return QMimeData() if html == txt: # wasn't of a supported media type; don't change html = None