diff --git a/tiny_gltf.h b/tiny_gltf.h index b2c76b9..d6b82a9 100644 --- a/tiny_gltf.h +++ b/tiny_gltf.h @@ -3000,7 +3000,9 @@ json_const_iterator ObjectEnd(const json &o) { #endif } -const char *GetKey(json_const_iterator &it) { +// Making this a const char* results in a pointer to a temporary when +// TINYGLTF_USE_RAPIDJSON is off. +std::string GetKey(json_const_iterator &it) { #ifdef TINYGLTF_USE_RAPIDJSON return it->name.GetString(); #else