[glib] exporter: give error on Describe of missing action



commit e275b8bc6c48aa7c894cb4f53bd1ee95850eb801
Author: Ryan Lortie <desrt desrt ca>
Date:   Mon Oct 28 14:49:14 2013 -0700

    exporter: give error on Describe of missing action
    
    If someone calls org.gtk.Actions.Describe on a non-existent action then
    return an exception instead of a trivial description (disabled, no
    state, etc.).
    
    https://bugzilla.gnome.org/show_bug.cgi?id=687185

 gio/gactiongroupexporter.c |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)
---
diff --git a/gio/gactiongroupexporter.c b/gio/gactiongroupexporter.c
index c906344..2e1e8f4 100644
--- a/gio/gactiongroupexporter.c
+++ b/gio/gactiongroupexporter.c
@@ -380,6 +380,14 @@ org_gtk_Actions_method_call (GDBusConnection       *connection,
       GVariant *desc;
 
       g_variant_get (parameters, "(&s)", &name);
+
+      if (!g_action_group_has_action (exporter->action_group, name))
+        {
+          g_dbus_method_invocation_return_error (invocation, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS,
+                                                 "The named action does not exist.");
+          return;
+        }
+
       desc = g_action_group_describe_action (exporter->action_group, name);
       result = g_variant_new ("(@(bgav))", desc);
     }


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