[gnome-software] trivial: Use a non-misleading error if two plugins handled file_to_app()



commit f306d7ae903eecf3b2b532894d142388111e8fd4
Author: Richard Hughes <richard hughsie com>
Date:   Tue Mar 7 09:18:10 2017 +0000

    trivial: Use a non-misleading error if two plugins handled file_to_app()

 src/gs-plugin-loader.c |   10 +++++++++-
 1 files changed, 9 insertions(+), 1 deletions(-)
---
diff --git a/src/gs-plugin-loader.c b/src/gs-plugin-loader.c
index c7eefc8..e31d43d 100644
--- a/src/gs-plugin-loader.c
+++ b/src/gs-plugin-loader.c
@@ -4389,7 +4389,7 @@ gs_plugin_loader_file_to_app_thread_cb (GTask *task,
        }
 
        /* success */
-       if (gs_app_list_length (job->list) != 1) {
+       if (gs_app_list_length (job->list) == 0) {
                g_task_return_new_error (task,
                                         GS_PLUGIN_ERROR,
                                         GS_PLUGIN_ERROR_NOT_SUPPORTED,
@@ -4397,6 +4397,14 @@ gs_plugin_loader_file_to_app_thread_cb (GTask *task,
                                         g_file_get_path (job->file));
                return;
        }
+       if (gs_app_list_length (job->list) > 1) {
+               g_task_return_new_error (task,
+                                        GS_PLUGIN_ERROR,
+                                        GS_PLUGIN_ERROR_NOT_SUPPORTED,
+                                        "more than one application was created for %s",
+                                        g_file_get_path (job->file));
+               return;
+       }
        g_task_return_pointer (task, g_object_ref (gs_app_list_index (job->list, 0)), (GDestroyNotify) 
g_object_unref);
 }
 


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