Forráskód Böngészése

Fix JSONParser::has_key/is_key_unique

Daniele Bartolini 12 éve
szülő
commit
c74f42c57e
1 módosított fájl, 12 hozzáadás és 2 törlés
  1. 12 2
      engine/core/json/JSONParser.cpp

+ 12 - 2
engine/core/json/JSONParser.cpp

@@ -264,7 +264,12 @@ bool JSONElement::has_key(const char* k) const
 
 	for (uint32_t i = 0; i < object.size(); i++)
 	{
-		if (string::strcmp(k, object[i].key) == 0)
+		TempAllocator256 key_alloc;
+		List<char> key(key_alloc);
+
+		JSONParser::parse_string(object[i].key, key);
+
+		if (string::strcmp(k, key.begin()) == 0)
 		{
 			return true;
 		}
@@ -284,7 +289,12 @@ bool JSONElement::is_key_unique(const char* k) const
 
 	for (uint32_t i = 0; i < object.size(); i++)
 	{
-		if (string::strcmp(k, object[i].key) == 0)
+		TempAllocator256 key_alloc;
+		List<char> key(key_alloc);
+
+		JSONParser::parse_string(object[i].key, key);
+
+		if (string::strcmp(k, key.begin()) == 0)
 		{
 			if (found == true)
 			{