diff options
author | Johan Bilien <jobi@litl.com> | 2010-09-17 23:04:33 +0000 |
---|---|---|
committer | Johan Bilien <jobi@litl.com> | 2010-09-17 19:16:46 -0400 |
commit | 21e25e643acce5f6641fa06b862a370ca0cbf9e2 (patch) | |
tree | 522a128471e89e5bfe3c0f543ebad1b4397dae55 | |
parent | 2cfed30cd282c95988d392aea867f188e113dca9 (diff) | |
download | gjs-21e25e643acce5f6641fa06b862a370ca0cbf9e2.tar.gz |
dbus: Don't return [ undefined ] when parsing an empty list of values
instead return []
This is a problem for asynchronously implemented methods with an empty
in-signature. Without the fix they are called with
methodAsync(undefined, dbusCallback) instead of the expected
methodAsync(dbusCallback);
https://bugzilla.gnome.org/show_bug.cgi?id=629965
-rw-r--r-- | modules/dbus-values.c | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/modules/dbus-values.c b/modules/dbus-values.c index 1dae1326..6d77767b 100644 --- a/modules/dbus-values.c +++ b/modules/dbus-values.c @@ -314,15 +314,17 @@ gjs_js_values_from_dbus(JSContext *context, array = gjs_rooted_array_new(); - do { - if (!gjs_js_one_value_from_dbus(context, iter, &value)) { - gjs_rooted_array_free(context, array, TRUE); - JS_RemoveRoot(context, &value); - return JS_FALSE; /* error message already set */ - } + if (dbus_message_iter_get_arg_type(iter) != DBUS_TYPE_INVALID) { + do { + if (!gjs_js_one_value_from_dbus(context, iter, &value)) { + gjs_rooted_array_free(context, array, TRUE); + JS_RemoveRoot(context, &value); + return JS_FALSE; /* error message already set */ + } - gjs_rooted_array_append(context, array, value); - } while (dbus_message_iter_next(iter)); + gjs_rooted_array_append(context, array, value); + } while (dbus_message_iter_next(iter)); + } *array_p = array; |