Fix GUI debug code

This commit is contained in:
DevilXD committed 2025-08-22 18:58:05 +02:00
1 parent cb9b6ab42f
commit 1b17dd6784
2 files changed
+16 -8

No files matched your search

+9 -2
View File
@@ -106,8 +106,15 @@ class ImageCache:
except (FileNotFoundError, Image_module.UnidentifiedImageError):
pass
if image is None:
async with self._twitch.request("GET", url) as response:
image = Image_module.open(io.BytesIO(await response.read()))
try:
async with self._twitch.request("GET", url) as response:
if response.status != 404:
image = Image_module.open(io.BytesIO(await response.read()))
except Exception:
pass
if image is None:
# use a blank white image as a fallback
image = Image_module.new("RGB", (10, 10), (255, 255, 255))
img_hash = self._hash(image)
self._images[img_hash] = image
image.save(CACHE_PATH / img_hash)