dbus: only warn, dot not raises an error (FS#713)

This is not user-called error, so it's a really bad idea to raise an Lua
error here.

Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
Julien Danjou 2010-06-06 10:46:01 +02:00
parent e0c259406e
commit bd30468d7a
1 changed files with 17 additions and 6 deletions

17
dbus.c
View File

@ -279,8 +279,11 @@ a_dbus_convert_value(lua_State *L, int idx, DBusMessageIter *iter)
int arraylen = lua_objlen(L, idx + 1); int arraylen = lua_objlen(L, idx + 1);
if(arraylen % 2 != 0) if(arraylen % 2 != 0)
luaL_error(globalconf.L, {
luaA_warn(globalconf.L,
"your D-Bus signal handling method returned wrong number of arguments"); "your D-Bus signal handling method returned wrong number of arguments");
return;
}
/* Push the array */ /* Push the array */
lua_pushvalue(L, idx + 1); lua_pushvalue(L, idx + 1);
@ -417,14 +420,22 @@ a_dbus_process_request(DBusConnection *dbus_connection, DBusMessage *msg)
dbus_message_iter_init_append(reply, &iter); dbus_message_iter_init_append(reply, &iter);
if(n % 2 != 0) if(n % 2 != 0)
luaL_error(globalconf.L, {
luaA_warn(globalconf.L,
"your D-Bus signal handling method returned wrong number of arguments"); "your D-Bus signal handling method returned wrong number of arguments");
/* Remove returned values from the stack */
lua_pop(L, - n);
return;
}
/* i is negative */ /* i is negative */
for(int i = n; i < 0; i += 2) for(int i = n; i < 0; i += 2)
{ {
if(!a_dbus_convert_value(globalconf.L, i, &iter)) if(!a_dbus_convert_value(globalconf.L, i, &iter))
luaL_error(globalconf.L, "your D-Bus signal handling method returned bad data"); {
luaA_warn(globalconf.L, "your D-Bus signal handling method returned bad data");
return;
}
lua_remove(globalconf.L, i); lua_remove(globalconf.L, i);
lua_remove(globalconf.L, i + 1); lua_remove(globalconf.L, i + 1);