diff options
author | wurstsalat <mailtrash@posteo.de> | 2023-09-02 21:32:22 +0300 |
---|---|---|
committer | wurstsalat <mailtrash@posteo.de> | 2023-09-02 21:32:27 +0300 |
commit | e50af2711d093e7113f670d2d795c60ce6639820 (patch) | |
tree | c48515d50d13049ec0e24cfc31b5601de4d84108 | |
parent | 6426f52555b5152d16c1416be4725f13f3122b77 (diff) |
fix: Catch error if loading image with PIL fails due to unidentifiable image
Fixes: #11616
-rw-r--r-- | gajim/gtk/util.py | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/gajim/gtk/util.py b/gajim/gtk/util.py index aaef0007c..90bdd53a6 100644 --- a/gajim/gtk/util.py +++ b/gajim/gtk/util.py @@ -43,6 +43,7 @@ from nbxmpp import util as nbxmpp_util from nbxmpp.structs import LocationData from nbxmpp.structs import TuneData from PIL import Image +from PIL import UnidentifiedImageError from gajim.common import app from gajim.common import configpaths @@ -619,7 +620,7 @@ def load_pixbuf(path: str | Path, with open(path, 'rb') as im_handle: img = Image.open(im_handle) avatar = img.convert('RGBA') - except (NameError, OSError): + except (NameError, OSError, UnidentifiedImageError): log.warning('Pillow convert failed: %s', path) log.debug('Error', exc_info=True) return None |