Use non-deprecated removeMember()

closes #683
This commit is contained in:
Christopher Dunn 2017-09-30 00:46:15 -05:00
parent 4d587638af
commit a3a4059367

View File

@ -1200,7 +1200,14 @@ Value Value::removeMember(const char* key)
}
Value Value::removeMember(const JSONCPP_STRING& key)
{
return removeMember(key.c_str());
JSON_ASSERT_MESSAGE(type_ == nullValue || type_ == objectValue,
"in Json::Value::removeMember(): requires objectValue");
if (type_ == nullValue)
return nullSingleton();
Value removed; // null
removeMember(key.c_str(), key.c_str() + key.size(), &removed);
return removed; // still null if removeMember() did nothing
}
bool Value::removeIndex(ArrayIndex index, Value* removed) {