Permalink
Browse files

only call add_arguments() if signature != ""

  • Loading branch information...
1 parent ea0600b commit 52dd02682b6bb109b37843743935886716768027 @esmil esmil committed Mar 10, 2009
Showing with 6 additions and 6 deletions.
  1. +0 −3 add.c
  2. +6 −3 simpledbus.c
View
3 add.c
@@ -179,9 +179,6 @@ EXPORT void add_arguments(lua_State *L, int i, int argc, const char *signature,
DBusMessageIter args;
DBusSignatureIter type;
- if (*signature == '\0')
- return;
-
dbus_message_iter_init_append(msg, &args);
dbus_signature_iter_init(&type, signature);
View
@@ -295,7 +295,7 @@ static void method_return_handler(DBusPendingCall *pending, lua_State *T)
* argument 3: object
* argument 4: interface
* argument 5: method
- * argument 6: signature
+ * argument 6: signature (optional)
* ...
*/
static int bus_call_method(lua_State *L)
@@ -329,8 +329,11 @@ static int bus_call_method(lua_State *L)
return error(L, "Couldn't create message");
/* get the signature and add arguments */
- if (lua_isstring(L, 6))
- add_arguments(L, 7, lua_gettop(L), lua_tostring(L, 6), msg);
+ if (lua_isstring(L, 6)) {
+ const char *signature = lua_tostring(L, 6);
+ if (*signature)
+ add_arguments(L, 7, lua_gettop(L), signature, msg);
+ }
if (!lua_pushthread(L)) { /* L can be yielded */
DBusPendingCall *pending;

0 comments on commit 52dd026

Please sign in to comment.