[gnome-software/wip/mcrha/app-row-runtime-warning] gs-app-row: Allow NULL size groups in gs_app_row_set_size_groups()



commit 248e3abe01b4e8fcb542b7cf8900dd449ed30225
Author: Milan Crha <mcrha redhat com>
Date:   Fri Jul 9 14:20:13 2021 +0200

    gs-app-row: Allow NULL size groups in gs_app_row_set_size_groups()
    
    The gs_update_list_add_app() explicitly calls gs_app_row_set_size_groups()
    with one argument NULL, which generates a runtime warning when opening
    list of history updates (gnome-software --mode=updated).

 src/gs-app-row.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)
---
diff --git a/src/gs-app-row.c b/src/gs-app-row.c
index 5e464e323..ac687b869 100644
--- a/src/gs-app-row.c
+++ b/src/gs-app-row.c
@@ -790,10 +790,14 @@ gs_app_row_set_size_groups (GsAppRow *app_row,
 {
        GsAppRowPrivate *priv = gs_app_row_get_instance_private (app_row);
 
-       gtk_size_group_add_widget (image, priv->image);
-       gtk_size_group_add_widget (name, priv->name_box);
-       gtk_size_group_add_widget (desc, priv->description_box);
-       gtk_size_group_add_widget (button, priv->button);
+       if (image != NULL)
+               gtk_size_group_add_widget (image, priv->image);
+       if (name != NULL)
+               gtk_size_group_add_widget (name, priv->name_box);
+       if (desc != NULL)
+               gtk_size_group_add_widget (desc, priv->description_box);
+       if (button != NULL)
+               gtk_size_group_add_widget (button, priv->button);
 }
 
 void


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