Skip to content

Commit a3a4059

Browse files
committed
Use non-deprecated removeMember()
closes open-source-parsers#683
1 parent 4d58763 commit a3a4059

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/lib_json/json_value.cpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1200,7 +1200,14 @@ Value Value::removeMember(const char* key)
12001200
}
12011201
Value Value::removeMember(const JSONCPP_STRING& key)
12021202
{
1203-
return removeMember(key.c_str());
1203+
JSON_ASSERT_MESSAGE(type_ == nullValue || type_ == objectValue,
1204+
"in Json::Value::removeMember(): requires objectValue");
1205+
if (type_ == nullValue)
1206+
return nullSingleton();
1207+
1208+
Value removed; // null
1209+
removeMember(key.c_str(), key.c_str() + key.size(), &removed);
1210+
return removed; // still null if removeMember() did nothing
12041211
}
12051212

12061213
bool Value::removeIndex(ArrayIndex index, Value* removed) {

0 commit comments

Comments
 (0)