[gnome-software: 2/3] gs-overview-page: Assert that hard-coded categories are found




commit 11137cb21ff1d408360977f3efde5781b69d674a
Author: Philip Withnall <pwithnall endlessos org>
Date:   Mon Jun 28 14:30:48 2021 +0100

    gs-overview-page: Assert that hard-coded categories are found
    
    I hit this when putting together the previous commit. Fail earlier and
    more clearly if the category IDs in
    `gs_overview_page_get_random_categories()` don’t exist.
    
    Signed-off-by: Philip Withnall <pwithnall endlessos org>

 src/gs-overview-page.c | 2 ++
 1 file changed, 2 insertions(+)
---
diff --git a/src/gs-overview-page.c b/src/gs-overview-page.c
index e9c2677b4..6294928c0 100644
--- a/src/gs-overview-page.c
+++ b/src/gs-overview-page.c
@@ -698,6 +698,8 @@ gs_overview_page_load (GsOverviewPage *self)
                                self->category_of_day = g_strdup (cat_id);
                        }
                        category = gs_category_manager_lookup (gs_plugin_loader_get_category_manager 
(self->plugin_loader), cat_id);
+                       g_assert (category != NULL);
+
                        featured_category = gs_category_find_child (category, "featured");
 
                        load_data = g_slice_new0 (LoadData);


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