[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>
This commit is contained in:
Markus Heiser 2025-01-28 14:21:55 +01:00 committed by Markus Heiser
parent 36a1ef1239
commit 906b9e7d4c
4 changed files with 10 additions and 5 deletions

View file

@ -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) ,