From 748b521ac6c720b87fbe1229cb34db26dae2f0ae Mon Sep 17 00:00:00 2001 From: Markus Heiser Date: Wed, 1 Oct 2025 07:01:27 +0200 Subject: [fix] searx/results.py - TypeError: object of type 'NoneType' has no len() In some engines, under certain circumstances, the content field can also have the value ``None``; in these cases, a length check results in an exception:: File "/usr/local/searxng/searx/results.py", line 360, in merge_two_main_results if len(other.content) > len(origin.content): ^^^^^^^^^^^^^^^^^^ TypeError: object of type 'NoneType' has no len() [1] https://github.com/searxng/searxng/issues/5250#issuecomment-3352863488 Reported-by: @scross01 [1] Signed-off-by: Markus Heiser --- searx/engines/pdbe.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'searx/engines') diff --git a/searx/engines/pdbe.py b/searx/engines/pdbe.py index 6dcb56169..a155c02fd 100644 --- a/searx/engines/pdbe.py +++ b/searx/engines/pdbe.py @@ -67,7 +67,7 @@ def construct_body(result): ) thumbnail = pdbe_preview_url.format(pdb_id=result['pdb_id']) except KeyError: - content = None + content = "" thumbnail = None # construct url for preview image -- cgit v1.2.3