mirror of
https://github.com/bblanchon/ArduinoJson.git
synced 2025-07-17 20:42:24 +02:00
Test that JsonArray grows after calling add()
This commit is contained in:
@ -38,16 +38,12 @@ JsonNode* JsonObject::getOrCreateNodeAt(const char* key)
|
||||
{
|
||||
if (!checkNodeType(JSON_OBJECT)) return 0;
|
||||
|
||||
JsonNode* lastChild = 0;
|
||||
|
||||
for (JsonNodeIterator it = beginChildren(); it != endChildren(); ++it)
|
||||
{
|
||||
const char* childKey = it->content.asKey.key;
|
||||
|
||||
if (!strcmp(childKey, key))
|
||||
return it->content.asKey.value;
|
||||
|
||||
lastChild = *it;
|
||||
}
|
||||
|
||||
JsonNode* newValueNode = createNode(JSON_UNDEFINED);
|
||||
@ -59,7 +55,7 @@ JsonNode* JsonObject::getOrCreateNodeAt(const char* key)
|
||||
newKeyNode->content.asKey.key = key;
|
||||
newKeyNode->content.asKey.value = newValueNode;
|
||||
|
||||
insertChildAfter(newKeyNode, lastChild);
|
||||
addChild(newKeyNode);
|
||||
|
||||
return newValueNode;
|
||||
}
|
||||
|
Reference in New Issue
Block a user