[libhandy/mcatanzaro/avatar-crash] avatar: fix crash when loading icons




commit f2ec0b3e1589093c7436c1317785b399c2db1d20
Author: Michael Catanzaro <mcatanzaro gnome org>
Date:   Sun Apr 18 16:55:48 2021 -0500

    avatar: fix crash when loading icons
    
    This function crashes whenever it succeeds. Oops. Let's make sure to
    only print an error message when there's actually an error.
    
    Fixes #433

 src/hdy-avatar.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
---
diff --git a/src/hdy-avatar.c b/src/hdy-avatar.c
index 63786c14..2148f455 100644
--- a/src/hdy-avatar.c
+++ b/src/hdy-avatar.c
@@ -348,7 +348,8 @@ load_from_gicon_async_for_export_cb (HdyAvatar    *self,
 
   pixbuf = load_from_gicon_async_finish (res, &error);
 
-  if (!g_error_matches (error, HDY_AVATAR_ICON_ERROR, HDY_AVATAR_ICON_ERROR_EMPTY) &&
+  if (error &&
+      !g_error_matches (error, HDY_AVATAR_ICON_ERROR, HDY_AVATAR_ICON_ERROR_EMPTY) &&
       !g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) {
     g_warning ("Failed to load icon: %s", error->message);
   }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]