Daniel Brötzmann pushed to branch master at gajim / gajim


Commits:
2554a4c2 by wurstsalat at 2024-04-08T22:38:29+02:00
fix: Utils: Catch exceptions when trying to load surfaces and icons

Fixes #11800

- - - - -


1 changed file:

- gajim/gtk/util.py


Changes:

=====================================
gajim/gtk/util.py
=====================================
@@ -104,7 +104,20 @@ def load_icon_surface(
     icon_info = load_icon_info(icon_name, size, scale, flags)
     if icon_info is None:
         return None
-    return icon_info.load_surface(None)
+
+    try:
+        surface = icon_info.load_surface(None)
+    except GLib.Error as e:
+        log.error(
+            'Error loading icon surface for %s, %s, %s: %s',
+            icon_name,
+            size,
+            scale,
+            e
+        )
+        return None
+
+    return surface
 
 
 def load_icon_pixbuf(icon_name: str,
@@ -116,7 +129,20 @@ def load_icon_pixbuf(icon_name: str,
     icon_info = load_icon_info(icon_name, size, scale, flags)
     if icon_info is None:
         return None
-    return icon_info.load_icon()
+
+    try:
+        icon = icon_info.load_icon()
+    except GLib.Error as e:
+        log.error(
+            'Error loading icon surface for %s, %s, %s: %s',
+            icon_name,
+            size,
+            scale,
+            e
+        )
+        return None
+
+    return icon
 
 
 def get_app_icon_list(scale_widget: Gtk.Widget) -> list[GdkPixbuf.Pixbuf]:



View it on GitLab: 
https://dev.gajim.org/gajim/gajim/-/commit/2554a4c21dc07b2b42205f96cc3ada7c60241f7a

-- 
View it on GitLab: 
https://dev.gajim.org/gajim/gajim/-/commit/2554a4c21dc07b2b42205f96cc3ada7c60241f7a
You're receiving this email because of your account on dev.gajim.org.


_______________________________________________
Commits mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to