diff --git a/src/lib_json/json_value.cpp b/src/lib_json/json_value.cpp index cce2b29..e2cb7a1 100644 --- a/src/lib_json/json_value.cpp +++ b/src/lib_json/json_value.cpp @@ -1155,10 +1155,14 @@ Value const& Value::operator[](CppTL::ConstString const& key) const { } #endif -Value& Value::append(const Value& value) { return (*this)[size()] = value; } - +Value& Value::append(const Value& value) { return append(Value(value)); } Value& Value::append(Value&& value) { - return (*this)[size()] = std::move(value); + JSON_ASSERT_MESSAGE(type() == nullValue || type() == arrayValue, + "in Json::Value::append: requires arrayValue"); + if (type() == nullValue) { + *this = Value(arrayValue); + } + return this->value_.map_->emplace(size(), std::move(value)).first->second; } Value Value::get(char const* begin,