[gnome-software] plugin loader: Don't pass NULL to g_task_return_error



commit 79bdd96f7a50bdc76a0161811e1927afa2bfb473
Author: Kalev Lember <kalevlember gmail com>
Date:   Mon Sep 15 16:43:17 2014 +0200

    plugin loader: Don't pass NULL to g_task_return_error
    
    ... to avoid running into error != NULL assertion in GTask code.
    
    Just fall through if the returned list is NULL and error isn't set;
    empty results are handled below.

 src/gs-plugin-loader.c |   14 +++++++-------
 1 files changed, 7 insertions(+), 7 deletions(-)
---
diff --git a/src/gs-plugin-loader.c b/src/gs-plugin-loader.c
index a8566f1..76f0340 100644
--- a/src/gs-plugin-loader.c
+++ b/src/gs-plugin-loader.c
@@ -976,7 +976,7 @@ gs_plugin_loader_get_updates_thread_cb (GTask *task,
                                                    state->flags,
                                                    cancellable,
                                                    &error);
-       if (state->list == NULL) {
+       if (error != NULL) {
                g_task_return_error (task, error);
                goto out;
        }
@@ -1091,7 +1091,7 @@ gs_plugin_loader_get_sources_thread_cb (GTask *task,
                                                    state->flags,
                                                    cancellable,
                                                    &error);
-       if (state->list == NULL) {
+       if (error != NULL) {
                g_task_return_error (task, error);
                goto out;
        }
@@ -1189,13 +1189,13 @@ gs_plugin_loader_get_installed_thread_cb (GTask *task,
                                                    state->flags,
                                                    cancellable,
                                                    &error);
-       state->list = g_list_concat (state->list, g_list_copy_deep (plugin_loader->priv->queued_installs, 
(GCopyFunc)g_object_ref, NULL));
-
-       if (state->list == NULL) {
+       if (error != NULL) {
                g_task_return_error (task, error);
                goto out;
        }
 
+       state->list = g_list_concat (state->list, g_list_copy_deep (plugin_loader->priv->queued_installs, 
(GCopyFunc)g_object_ref, NULL));
+
        /* filter package list */
        gs_plugin_list_filter (&state->list, gs_plugin_loader_app_is_valid, NULL);
        if (state->list == NULL) {
@@ -1297,7 +1297,7 @@ gs_plugin_loader_get_popular_thread_cb (GTask *task,
                                                    state->popular_category_exclude,
                                                    cancellable,
                                                    &error);
-       if (state->list == NULL) {
+       if (error != NULL) {
                g_task_return_error (task, error);
                goto out;
        }
@@ -1404,7 +1404,7 @@ gs_plugin_loader_get_featured_thread_cb (GTask *task,
                                                    state->flags,
                                                    cancellable,
                                                    &error);
-       if (state->list == NULL) {
+       if (error != NULL) {
                g_task_return_error (task, error);
                goto out;
        }


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