[fix] results.py: crashes when 'parsed_url' is None

This commit is contained in:
Bnyro 2025-02-08 16:51:37 +01:00 committed by Markus Heiser
parent 28ead13eb9
commit 3a59aea742

View File

@ -318,8 +318,9 @@ class ResultContainer:
def __find_duplicated_http_result(self, result): def __find_duplicated_http_result(self, result):
result_template = result.get('template') result_template = result.get('template')
for merged_result in self._merged_results: for merged_result in self._merged_results:
if 'parsed_url' not in merged_result: if not merged_result.get('parsed_url'):
continue continue
if compare_urls(result['parsed_url'], merged_result['parsed_url']) and result_template == merged_result.get( if compare_urls(result['parsed_url'], merged_result['parsed_url']) and result_template == merged_result.get(
'template' 'template'
): ):
@ -385,6 +386,9 @@ class ResultContainer:
categoryPositions = {} categoryPositions = {}
for res in results: for res in results:
if not res.get('url'):
continue
# do we need to handle more than one category per engine? # do we need to handle more than one category per engine?
engine = engines[res['engine']] engine = engines[res['engine']]
res['category'] = engine.categories[0] if len(engine.categories) > 0 else '' res['category'] = engine.categories[0] if len(engine.categories) > 0 else ''