]> git.ipfire.org Git - telemetry.git/commitdiff
dbus: Don't send an empty graph array
authorMichael Tremer <michael.tremer@ipfire.org>
Fri, 10 Jul 2026 13:44:57 +0000 (13:44 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Fri, 10 Jul 2026 13:44:57 +0000 (13:44 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/daemon/graph-bus.c

index c0190f829f91e3fe8e89882eeb2ad64b8a44dc3b..e3816db653d4625380f9900a5aba885c225c6e6c 100644 (file)
@@ -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);