From d3daf96ff0d82e744604424e8498e22c307637e2 Mon Sep 17 00:00:00 2001 From: Yannik Schmidt Date: Sat, 11 May 2024 20:06:16 +0200 Subject: [PATCH] fix: skip broken images for thumbnail --- client.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/client.py b/client.py index 211b50f..14d2223 100644 --- a/client.py +++ b/client.py @@ -206,9 +206,13 @@ def create_main_window_tile(software): '''Create the main window tile''' if software.get_thumbnail(): - img = PIL.Image.open(software.get_thumbnail()) - img = imagetools.smart_resize(img, 200, 300) - #img = img.resize((200, 300)) + try: + print("Loading thumbnail:", software.get_thumbnail()) + img = PIL.Image.open(software.get_thumbnail()) + img = imagetools.smart_resize(img, 200, 300) + except PIL.UnidentifiedImageError: + print("Failed to load thumbnail:", software.get_thumbnail()) + img = PIL.Image.new('RGB', (200, 300)) else: img = PIL.Image.new('RGB', (200, 300))