summaryrefslogtreecommitdiff
path: root/searx/result_types
diff options
context:
space:
mode:
authorMarkus Heiser <markus.heiser@darmarit.de>2025-01-28 14:21:55 +0100
committerMarkus Heiser <markus.heiser@darmarIT.de>2025-01-28 16:28:12 +0100
commit906b9e7d4c87dcb7ded4ef1248e9569caf408cc7 (patch)
treef2f15c87528632b38116a58cc5bcb41e74be97f5 /searx/result_types
parent36a1ef12399d529f210ceb4f8b28f497fabd0834 (diff)
[fix] hostnames plugin: AttributeError: 'NoneType' object has no attribute 'netloc'
Closes: https://github.com/searxng/searxng/issues/4245 Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
Diffstat (limited to 'searx/result_types')
-rw-r--r--searx/result_types/answer.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/searx/result_types/answer.py b/searx/result_types/answer.py
index 1042fe00e..a9f580e0e 100644
--- a/searx/result_types/answer.py
+++ b/searx/result_types/answer.py
@@ -116,6 +116,10 @@ class Translations(BaseAnswer, kw_only=True):
translations: list[Translations.Item]
"""List of translations."""
+ def __post_init__(self):
+ if not self.translations:
+ raise ValueError("Translation does not have an item in the list translations")
+
class Item(msgspec.Struct, kw_only=True):
"""A single element of the translations / a translation. A translation
consists of at least a mandatory ``text`` property (the translation) ,