From bd30468d7a5da193b6d3dca963f2550d7657066b Mon Sep 17 00:00:00 2001 From: Julien Danjou Date: Sun, 6 Jun 2010 10:46:01 +0200 Subject: [PATCH] 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 --- dbus.c | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/dbus.c b/dbus.c index ab3f01970..193d45c6c 100644 --- a/dbus.c +++ b/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, - "your D-Bus signal handling method returned wrong number of arguments"); + { + luaA_warn(globalconf.L, + "your D-Bus signal handling method returned wrong number of arguments"); + return; + } /* Push the array */ lua_pushvalue(L, idx + 1); @@ -339,7 +342,7 @@ a_dbus_convert_value(lua_State *L, int idx, DBusMessageIter *iter) /** Process a single request from D-Bus * \param dbus_connection The connection to the D-Bus server. - * \param msg The D-Bus message request being sent to the D-Bus connection. + * \param msg The D-Bus message request being sent to the D-Bus connection. */ static void a_dbus_process_request(DBusConnection *dbus_connection, DBusMessage *msg) @@ -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, - "your D-Bus signal handling method returned wrong number of arguments"); + { + 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);