From 516748c78291ab8f41b8d7621769d2a89f276ddf Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Wed, 22 Mar 2023 16:24:50 +1000 Subject: [PATCH] hasUrls() may be true even if there are no URLs Silences the error on https://forums.ankiweb.net/t/error-message-with-forvo/28529 --- qt/aqt/editor.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/qt/aqt/editor.py b/qt/aqt/editor.py index 857d94b18..e0b36f351 100644 --- a/qt/aqt/editor.py +++ b/qt/aqt/editor.py @@ -1294,7 +1294,11 @@ class EditorWebView(AnkiWebView): return html_content, internal # favour url if it's a local link - if mime.hasUrls() and mime.urls()[0].toString().startswith("file://"): + if ( + mime.hasUrls() + and (urls := mime.urls()) + and urls[0].toString().startswith("file://") + ): types = (self._processUrls, self._processImage, self._processText) else: types = (self._processImage, self._processUrls, self._processText)