From a770e1489123a0c758cd9bcb6826d44731213e89 Mon Sep 17 00:00:00 2001 From: cnjhb Date: Sat, 11 Oct 2025 09:58:07 +0800 Subject: [PATCH] bus: sender can be NULL --- src/bus.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/bus.c b/src/bus.c index 2833985..f08565c 100644 --- a/src/bus.c +++ b/src/bus.c @@ -749,7 +749,9 @@ static int bus_subscribe(lua_State *L) { struct easydbus_state *state = lua_touserdata(L, lua_upvalueindex(1)); GDBusConnection *conn = get_conn(L, 1); - const char *sender = lua_tostring(L, 2); + const char *sender = NULL; + if (lua_isnoneornil(L, 2)) + sender = lua_tostring(L, 2); const char *object_path = lua_tostring(L, 3); const char *interface_name = lua_tostring(L, 4); const char *signal_name = lua_tostring(L, 5);