diff --git a/include/nbt.hpp b/include/nbt.hpp index 4284a12..525fb7c 100644 --- a/include/nbt.hpp +++ b/include/nbt.hpp @@ -854,8 +854,8 @@ namespace tags { auto iter = value.find(name); if (iter == value.end()) { auto ptr = std::make_unique>(); - typename tag_of::value_type & result = *ptr->value; - value.insert(name, std::move(ptr)); + typename tag_of::value_type & result = ptr->value; + value.emplace(name, std::move(ptr)); return result; } else { return dynamic_cast &>(*iter->second).value;