Removed duplication when one replaces a value in a (PR #232 by @ulion)

This commit is contained in:
ulion authored and Benoit Blanchon committed 2016-02-23 21:27:52 +01:00
1 parent 6ab23bd523
commit b47a3b566a
3 files changed
+35 -2

No files matched your search

+6 -2
View File
@@ -55,8 +55,12 @@ inline void JsonObject::remove(JsonObjectKey key) {
template <typename T>
inline bool JsonObject::setNodeAt(JsonObjectKey key, T value) {
node_type *node = getNodeAt(key.c_str());
if (!node) node = addNewNode();
return node && setNodeKey(node, key) && setNodeValue<T>(node, value);
if (!node) {
node = addNewNode();
if (!node || !setNodeKey(node, key))
return false;
}
return setNodeValue<T>(node, value);
}
inline bool JsonObject::setNodeKey(node_type *node, JsonObjectKey key) {