[ox/oc] Make write omit lists if length is 0

This commit is contained in:
Gary Talent 2022-05-28 20:33:05 -05:00
parent 717bbd2e0f
commit d5252a45d3

View File

@ -89,7 +89,7 @@ class OrganicClawWriter {
template<typename T> template<typename T>
Error OrganicClawWriter::field(const char *key, T *val, std::size_t len) noexcept { Error OrganicClawWriter::field(const char *key, T *val, std::size_t len) noexcept {
if (targetValid()) { if (targetValid() && len) {
OrganicClawWriter w((Json::Value(Json::arrayValue))); OrganicClawWriter w((Json::Value(Json::arrayValue)));
for (std::size_t i = 0; i < len; ++i) { for (std::size_t i = 0; i < len; ++i) {
oxReturnError(w.field("", &val[i])); oxReturnError(w.field("", &val[i]));