From: Michael Tremer Date: Fri, 10 Jul 2026 13:44:57 +0000 (+0000) Subject: dbus: Don't send an empty graph array X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=144e7ccb17761b6e336c353f2a580e855237847d;p=telemetry.git dbus: Don't send an empty graph array Signed-off-by: Michael Tremer --- diff --git a/src/daemon/graph-bus.c b/src/daemon/graph-bus.c index c0190f8..e3816db 100644 --- a/src/daemon/graph-bus.c +++ b/src/daemon/graph-bus.c @@ -283,34 +283,36 @@ static int td_graph_bus_render(sd_bus_message* m, void* data, sd_bus_error* erro goto ERROR; // Append the graph - r = sd_bus_message_open_container(reply, 'e', "sv"); - if (r < 0) - goto ERROR; + if (buffer) { + r = sd_bus_message_open_container(reply, 'e', "sv"); + if (r < 0) + goto ERROR; - // Add the key - r = sd_bus_message_append(reply, "s", "graph"); - if (r < 0) - goto ERROR; + // Add the key + r = sd_bus_message_append(reply, "s", "graph"); + if (r < 0) + goto ERROR; - // Create the value (an array of bytes) - r = sd_bus_message_open_container(reply, 'v', "ay"); - if (r < 0) - goto ERROR; + // Create the value (an array of bytes) + r = sd_bus_message_open_container(reply, 'v', "ay"); + if (r < 0) + goto ERROR; - // Write the payload - r = sd_bus_message_append_array(reply, 'y', buffer, length); - if (r < 0) - goto ERROR; + // Write the payload + r = sd_bus_message_append_array(reply, 'y', buffer, length); + if (r < 0) + goto ERROR; - // Close the value array - r = sd_bus_message_close_container(reply); - if (r < 0) - goto ERROR; + // Close the value array + r = sd_bus_message_close_container(reply); + if (r < 0) + goto ERROR; - // Close the entry - r = sd_bus_message_close_container(reply); - if (r < 0) - goto ERROR; + // Close the entry + r = sd_bus_message_close_container(reply); + if (r < 0) + goto ERROR; + } // Close the array r = sd_bus_message_close_container(reply);