[gnome-software] trivial: Log an error when a job is created without a valid action
- From: Richard Hughes <rhughes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-software] trivial: Log an error when a job is created without a valid action
- Date: Sat, 1 Jul 2017 19:38:25 +0000 (UTC)
commit 0b99795f8af13ecc30690027132819091201e6b6
Author: Richard Hughes <richard hughsie com>
Date: Fri Jun 30 10:04:06 2017 +0100
trivial: Log an error when a job is created without a valid action
lib/gs-plugin-loader.c | 11 +++++++++++
src/gs-update-monitor.c | 2 +-
2 files changed, 12 insertions(+), 1 deletions(-)
---
diff --git a/lib/gs-plugin-loader.c b/lib/gs-plugin-loader.c
index 4df0c96..e842891 100644
--- a/lib/gs-plugin-loader.c
+++ b/lib/gs-plugin-loader.c
@@ -3341,6 +3341,17 @@ gs_plugin_loader_job_process_async (GsPluginLoader *plugin_loader,
g_return_if_fail (GS_IS_PLUGIN_JOB (plugin_job));
g_return_if_fail (cancellable == NULL || G_IS_CANCELLABLE (cancellable));
+ /* check job has valid action */
+ if (gs_plugin_job_get_action (plugin_job) == GS_PLUGIN_ACTION_UNKNOWN) {
+ g_autofree gchar *job_str = gs_plugin_job_to_string (plugin_job);
+ task = g_task_new (plugin_loader, cancellable_job, callback, user_data);
+ g_task_return_new_error (task,
+ GS_PLUGIN_ERROR,
+ GS_PLUGIN_ERROR_NOT_SUPPORTED,
+ "job has no valid action: %s", job_str);
+ return;
+ }
+
/* deal with the install queue */
action = gs_plugin_job_get_action (plugin_job);
if (action == GS_PLUGIN_ACTION_REMOVE) {
diff --git a/src/gs-update-monitor.c b/src/gs-update-monitor.c
index 811ca75..ebba1ae 100644
--- a/src/gs-update-monitor.c
+++ b/src/gs-update-monitor.c
@@ -470,7 +470,7 @@ check_updates (GsUpdateMonitor *monitor)
g_debug ("Refreshing for metadata only");
}
- plugin_job = gs_plugin_job_newv (GS_PLUGIN_ACTION_UNKNOWN,
+ plugin_job = gs_plugin_job_newv (GS_PLUGIN_ACTION_REFRESH,
"failure-flags", GS_PLUGIN_FAILURE_FLAGS_NONE,
"refresh-flags", refresh_flags,
"age", 60 * 60 * 24,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]