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);