[gnome-software] trivial: Fix crash when a flatpak runtime is not set



commit 590299a5ff8081b293ad0b6db4cd3c5062688f95
Author: Richard Hughes <richard hughsie com>
Date:   Mon Jan 16 14:15:02 2017 +0000

    trivial: Fix crash when a flatpak runtime is not set

 src/gs-utils.c           |    1 +
 src/plugins/gs-flatpak.c |    7 +++++--
 2 files changed, 6 insertions(+), 2 deletions(-)
---
diff --git a/src/gs-utils.c b/src/gs-utils.c
index afd3e1b..9c2c7e6 100644
--- a/src/gs-utils.c
+++ b/src/gs-utils.c
@@ -549,6 +549,7 @@ gs_utils_get_wilson_rating (guint64 star1,
 void
 gs_utils_error_add_unique_id (GError **error, GsApp *app)
 {
+       g_return_if_fail (GS_APP (app));
        if (error == NULL || *error == NULL)
                return;
        g_prefix_error (error, "[%s] ", gs_app_get_unique_id (app));
diff --git a/src/plugins/gs-flatpak.c b/src/plugins/gs-flatpak.c
index 661ca63..40124c3 100644
--- a/src/plugins/gs-flatpak.c
+++ b/src/plugins/gs-flatpak.c
@@ -2176,8 +2176,11 @@ install_runtime_for_app (GsFlatpak *self,
                         GCancellable *cancellable,
                         GError **error)
 {
-       GsApp *runtime;
-       runtime = gs_app_get_update_runtime (app);
+       GsApp *runtime = gs_app_get_update_runtime (app);
+
+       /* no runtime required */
+       if (runtime == NULL)
+               return TRUE;
 
        /* the runtime could come from a different remote to the app */
        if (!gs_refine_item_metadata (self, runtime, cancellable, error)) {


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