[gnome-software/gnome-40: 1/2] gs-app-row: Allow NULL size groups in gs_app_row_set_size_groups()




commit b0957bc9ed3860288d597150fc6de08ae3a0c319
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 039efc541..6fefdbb03 100644
--- a/src/gs-app-row.c
+++ b/src/gs-app-row.c
@@ -781,10 +781,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]