From 2c3a8b2787630e00001176629c7938377060ea76 Mon Sep 17 00:00:00 2001 From: Magnus Henoch Date: Thu, 3 Jan 2008 16:35:44 +0000 Subject: [PATCH] * dbusbind.c (Fdbus_call_method): Handle the case of no returned arguments. --- src/ChangeLog | 1 + src/dbusbind.c | 19 ++++++++++--------- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index a8cccf957b4..10ed2dc890a 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -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 (tiny change) diff --git a/src/dbusbind.c b/src/dbusbind.c index 1b6642b834f..a0c928d0eea 100644 --- a/src/dbusbind.c +++ b/src/dbusbind.c @@ -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. */ -- 2.39.2