diff src/dbusbind.c @ 87535:6dcf49457032

* dbusbind.c (Fdbus_call_method): Handle the case of no returned arguments.
author Magnus Henoch <mange@freemail.hu>
date Thu, 03 Jan 2008 16:35:26 +0000
parents d24ee3180427
children 6a710fa21688
line wrap: on
line diff
--- a/src/dbusbind.c	Thu Jan 03 16:34:07 2008 +0000
+++ b/src/dbusbind.c	Thu Jan 03 16:35:26 2008 +0000
@@ -813,18 +813,19 @@
   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.  */