diff --git a/src/NBT/StringTag.hpp b/src/NBT/StringTag.hpp index 8672b73..6fb2b41 100644 --- a/src/NBT/StringTag.hpp +++ b/src/NBT/StringTag.hpp @@ -50,8 +50,12 @@ public: return Type; } + std::string getValue() const { + return std::string(reinterpret_cast(ptr), len); + } + virtual void print(std::ostream& os, const std::string &) const { - os << "\"" << std::string(reinterpret_cast(ptr), len) << "\""; + os << "\"" << getValue() << "\""; } };