]> git.eshelyaron.com Git - emacs.git/commitdiff
* dbusbind.c (Fdbus_call_method): Handle the case of no returned
authorMagnus Henoch <mange@freemail.hu>
Thu, 3 Jan 2008 16:35:44 +0000 (16:35 +0000)
committerMagnus Henoch <mange@freemail.hu>
Thu, 3 Jan 2008 16:35:44 +0000 (16:35 +0000)
arguments.

src/ChangeLog
src/dbusbind.c

index a8cccf957b4b8cd8e00f0ac3ade10e19f4adf0d5..10ed2dc890aafea777d0ccaed249d10ca37b314f 100644 (file)
@@ -2,6 +2,7 @@
 
        * dbusbind.c (xd_append_arg): Use unsigned char instead of
        unsigned int for byte values (necessary for big-endian platform).
+       (Fdbus_call_method): Handle the case of no returned arguments.
 
 2007-12-31  Tom Tromey <tromey@redhat.com>  (tiny change)
 
index 1b6642b834fc5ef54ea09ba3e8ef9cd878ed7ad9..a0c928d0eea7eeba5d3cd73cc8f886cef2f465b4 100644 (file)
@@ -813,18 +813,19 @@ usage: (dbus-call-method BUS SERVICE PATH INTERFACE METHOD &rest ARGS)  */)
   result = Qnil;
   GCPRO1 (result);
 
-  if (!dbus_message_iter_init (reply, &iter))
+  if (dbus_message_iter_init (reply, &iter))
     {
-      UNGCPRO;
-      xsignal1 (Qdbus_error, build_string ("Cannot read reply"));
+      /* Loop over the parameters of the D-Bus reply message.  Construct a
+        Lisp list, which is returned by `dbus-call-method'.  */
+      while ((dtype = dbus_message_iter_get_arg_type (&iter)) != DBUS_TYPE_INVALID)
+       {
+         result = Fcons (xd_retrieve_arg (dtype, &iter), result);
+         dbus_message_iter_next (&iter);
+       }
     }
-
-  /* Loop over the parameters of the D-Bus reply message.  Construct a
-     Lisp list, which is returned by `dbus-call-method'.  */
-  while ((dtype = dbus_message_iter_get_arg_type (&iter)) != DBUS_TYPE_INVALID)
+  else
     {
-      result = Fcons (xd_retrieve_arg (dtype, &iter), result);
-      dbus_message_iter_next (&iter);
+      /* No arguments: just return nil. */
     }
 
   /* Cleanup.  */