[gnome-software/gnome-3-30] flatpak: Add asserts when building a ref



commit aec6e599ec3bcad93987d96f20a7c7dd1483577c
Author: Kalev Lember <klember redhat com>
Date:   Sun Sep 23 09:43:10 2018 +0200

    flatpak: Add asserts when building a ref
    
    Having these would have made debugging
    https://gitlab.gnome.org/GNOME/gnome-software/issues/459 much easier and
    immediately obvious what's going on.

 plugins/flatpak/gs-flatpak-app.c | 18 ++++++++++++++----
 1 file changed, 14 insertions(+), 4 deletions(-)
---
diff --git a/plugins/flatpak/gs-flatpak-app.c b/plugins/flatpak/gs-flatpak-app.c
index 071877e0..a71b0eed 100644
--- a/plugins/flatpak/gs-flatpak-app.c
+++ b/plugins/flatpak/gs-flatpak-app.c
@@ -105,11 +105,21 @@ gs_flatpak_app_get_repo_url (GsApp *app)
 gchar *
 gs_flatpak_app_get_ref_display (GsApp *app)
 {
+       const gchar *ref_kind_as_str = gs_flatpak_app_get_ref_kind_as_str (app);
+       const gchar *ref_name = gs_flatpak_app_get_ref_name (app);
+       const gchar *ref_arch = gs_flatpak_app_get_ref_arch (app);
+       const gchar *ref_branch = gs_flatpak_app_get_ref_branch (app);
+
+       g_assert (ref_kind_as_str != NULL);
+       g_assert (ref_name != NULL);
+       g_assert (ref_arch != NULL);
+       g_assert (ref_branch != NULL);
+
        return g_strdup_printf ("%s/%s/%s/%s",
-                               gs_flatpak_app_get_ref_kind_as_str (app),
-                               gs_flatpak_app_get_ref_name (app),
-                               gs_flatpak_app_get_ref_arch (app),
-                               gs_flatpak_app_get_ref_branch (app));
+                               ref_kind_as_str,
+                               ref_name,
+                               ref_arch,
+                               ref_branch);
 }
 
 void


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