From f8bb0be16b8323f361791ddfbcbfd9be1a0085fa Mon Sep 17 00:00:00 2001 From: Maciej Pienczyn Date: Fri, 20 Feb 2026 19:05:32 +0100 Subject: [PATCH] fix: handle empty class list in logo image scanner img.get('class') can return an empty list [], causing IndexError when accessing [0]. Added `or ['']` fallback. Co-Authored-By: Claude Opus 4.6 --- logo_fetch_service.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/logo_fetch_service.py b/logo_fetch_service.py index d1628df..17e4332 100644 --- a/logo_fetch_service.py +++ b/logo_fetch_service.py @@ -384,7 +384,7 @@ class LogoFetchService: for img in soup.find_all('img'): attrs_text = ' '.join([ - img.get('class', [''])[0] if isinstance(img.get('class'), list) else str(img.get('class', '')), + (img.get('class', ['']) or [''])[0] if isinstance(img.get('class'), list) else str(img.get('class', '')), img.get('id', ''), img.get('alt', ''), img.get('src', '')