From 906b9e7d4c87dcb7ded4ef1248e9569caf408cc7 Mon Sep 17 00:00:00 2001 From: Markus Heiser Date: Tue, 28 Jan 2025 14:21:55 +0100 Subject: [fix] hostnames plugin: AttributeError: 'NoneType' object has no attribute 'netloc' Closes: https://github.com/searxng/searxng/issues/4245 Signed-off-by: Markus Heiser --- searx/result_types/answer.py | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'searx/result_types') 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) , -- cgit v1.2.3