uh_ubus_init_json_rpc_response(cl, &buf);
r = blobmsg_open_array(&buf, "result");
blobmsg_add_u32(&buf, "", ret);
- c = blobmsg_open_table(&buf, NULL);
- blob_for_each_attr(cur, du->buf.head, rem)
- blobmsg_add_blob(&buf, cur);
- blobmsg_close_table(&buf, c);
+
+ if (blob_len(du->buf.head)) {
+ c = blobmsg_open_table(&buf, NULL);
+ blob_for_each_attr(cur, du->buf.head, rem)
+ blobmsg_add_blob(&buf, cur);
+ blobmsg_close_table(&buf, c);
+ }
+
blobmsg_close_array(&buf, r);
uh_ubus_send_response(cl, &buf);
return;