[gnome-software/wip/ubuntu-changes] trivial: Add g_return_if_fail to gs_app_add|has_quirk. Fix check for gs_app_set_license



commit 4713b9cb51785f47802962c6f9e5e9638b747323
Author: Robert Ancell <robert ancell canonical com>
Date:   Wed Mar 16 16:41:30 2016 +1300

    trivial: Add g_return_if_fail to gs_app_add|has_quirk. Fix check for gs_app_set_license

 src/gs-app.c |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)
---
diff --git a/src/gs-app.c b/src/gs-app.c
index c300875..ebe5747 100644
--- a/src/gs-app.c
+++ b/src/gs-app.c
@@ -1291,13 +1291,13 @@ gs_app_set_license (GsApp *app, GsAppQuality quality, const gchar *licence)
        guint i;
        g_auto(GStrv) tokens = NULL;
 
+       g_return_if_fail (GS_IS_APP (app));
+
        /* only save this if the data is sufficiently high quality */
        if (quality <= app->licence_quality)
                return;
        app->licence_quality = quality;
 
-       g_return_if_fail (GS_IS_APP (app));
-
        /* assume free software until we find an unmatched SPDX token */
        app->licence_is_free = TRUE;
 
@@ -2019,6 +2019,8 @@ gs_app_set_to_be_installed (GsApp *app, gboolean to_be_installed)
 gboolean
 gs_app_has_quirk (GsApp *app, AsAppQuirk quirk)
 {
+       g_return_val_if_fail (GS_IS_APP (app), FALSE);
+
        return (app->quirk & quirk) > 0;
 }
 
@@ -2028,6 +2030,8 @@ gs_app_has_quirk (GsApp *app, AsAppQuirk quirk)
 void
 gs_app_add_quirk (GsApp *app, AsAppQuirk quirk)
 {
+       g_return_if_fail (GS_IS_APP (app));
+
        app->quirk |= quirk;
 }
 


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