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:
parent
dd84d88e0f
commit
ab08b302be
17
dbus.c
17
dbus.c
|
@ -279,8 +279,11 @@ a_dbus_convert_value(lua_State *L, int idx, DBusMessageIter *iter)
|
|||
int arraylen = lua_objlen(L, idx + 1);
|
||||
|
||||
if(arraylen % 2 != 0)
|
||||
luaL_error(globalconf.L,
|
||||
{
|
||||
luaA_warn(globalconf.L,
|
||||
"your D-Bus signal handling method returned wrong number of arguments");
|
||||
return;
|
||||
}
|
||||
|
||||
/* Push the array */
|
||||
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);
|
||||
|
||||
if(n % 2 != 0)
|
||||
luaL_error(globalconf.L,
|
||||
{
|
||||
luaA_warn(globalconf.L,
|
||||
"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 */
|
||||
for(int i = n; i < 0; i += 2)
|
||||
{
|
||||
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 + 1);
|
||||
|
|
Loading…
Reference in New Issue