[gnome-software: 1/4] gs-appstream: Don’t add a NULL icon to an app




commit 57be28fbaef824e30be59d222a7f21d8a89f8902
Author: Philip Withnall <pwithnall endlessos org>
Date:   Fri Mar 4 14:38:31 2022 +0000

    gs-appstream: Don’t add a NULL icon to an app
    
    `gs_icon_new_for_appstream_icon()` can legitimately return `NULL`.
    
    This avoids a critical warning. It’s likely only possible to trigger
    this by using `--show-metainfo` and not specifying an icon.
    
    Signed-off-by: Philip Withnall <pwithnall endlessos org>

 lib/gs-appstream.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
---
diff --git a/lib/gs-appstream.c b/lib/gs-appstream.c
index 16b71ba45..d812a3c09 100644
--- a/lib/gs-appstream.c
+++ b/lib/gs-appstream.c
@@ -245,7 +245,8 @@ app_add_icon (GsApp  *app,
               AsIcon *as_icon)
 {
        g_autoptr(GIcon) icon = gs_icon_new_for_appstream_icon (as_icon);
-       gs_app_add_icon (app, icon);
+       if (icon != NULL)
+               gs_app_add_icon (app, icon);
 }
 
 static void


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