From 61f7c70d3c3e303f2694e2baec1eb13753aa3fee Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Mon, 24 Jul 2023 10:28:07 +1000 Subject: [PATCH] Don't throw on empty URLs in clipboard https://forums.ankiweb.net/t/dragging-and-dropping-picture-error/32313 --- qt/aqt/editor.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/qt/aqt/editor.py b/qt/aqt/editor.py index 34f2cac35..4bda62e0e 100644 --- a/qt/aqt/editor.py +++ b/qt/aqt/editor.py @@ -1341,8 +1341,9 @@ class EditorWebView(AnkiWebView): for qurl in mime.urls(): url = qurl.toString() # chrome likes to give us the URL twice with a \n - url = url.splitlines()[0] - buf += self.editor.urlToLink(url) + if lines := url.splitlines(): + url = lines[0] + buf += self.editor.urlToLink(url) return buf