From 01d54380acba0ef907d8a265f7e0155d4c59bbee Mon Sep 17 00:00:00 2001 From: Rahul Sheth Date: Fri, 10 Jul 2020 14:27:37 -0400 Subject: [PATCH] Use std::string instead of const char* for GetKey function --- tiny_gltf.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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