From b5eab5dec38ec9c0ee214b548092125fce80204c Mon Sep 17 00:00:00 2001 From: nick Date: Sun, 1 Mar 2026 12:53:20 -0500 Subject: [PATCH] Avoid crash when icon is missing from theme --- src/hamster/lib/graphics.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/hamster/lib/graphics.py b/src/hamster/lib/graphics.py index af4ceb750..a44ee73cf 100644 --- a/src/hamster/lib/graphics.py +++ b/src/hamster/lib/graphics.py @@ -1440,9 +1440,13 @@ def __init__(self, name, size=24, **kwargs): def __setattr__(self, name, val): BitmapSprite.__setattr__(self, name, val) - if name in ('name', 'size'): # no other reason to discard cache than just on path change + if name in ('name', 'size'): # no other reason to discard cache than just on path change if self.__dict__.get('name') and self.__dict__.get('size'): - self.image_data = self.theme.load_icon(self.name, self.size, 0) + try: + self.image_data = self.theme.load_icon(self.name, self.size, 0) + except: + # Missing / broken icon should not crash the app + self.image_data = None else: self.image_data = None