prevent segfault when dbus signal creation failed

This commit is contained in:
▟ ▖▟ ▖ 2015-04-02 01:10:16 +02:00 committed by Uli Schlachter
parent e8d209fde6
commit 33d4100ea0
1 changed files with 4 additions and 0 deletions

4
dbus.c
View File

@ -819,6 +819,10 @@ luaA_dbus_emit_signal(lua_State *L)
const char *name = luaL_checkstring(L, 4); const char *name = luaL_checkstring(L, 4);
DBusConnection *dbus_connection = a_dbus_bus_getbyname(bus_name); DBusConnection *dbus_connection = a_dbus_bus_getbyname(bus_name);
DBusMessage* msg = dbus_message_new_signal(path, itface, name); DBusMessage* msg = dbus_message_new_signal(path, itface, name);
if (msg == NULL) {
luaA_warn(L, "your D-Bus signal emitting method error'd");
return 0;
}
DBusMessageIter iter; DBusMessageIter iter;
dbus_message_iter_init_append(msg, &iter); dbus_message_iter_init_append(msg, &iter);