mirror of
https://github.com/nlohmann/json.git
synced 2025-07-28 12:02:00 +03:00
Fix patch::add creating nonexistent parents (#3628)
* Fix patch::add creating nonexistent parents The previous behavior was not in accordance with RFC6902. Add unit test. Fixes #3134. * Fix incorrect JSON patch unit test Co-authored-by: Hudson00 <yagdhscdasg@gmail.com>
This commit is contained in:
committed by
GitHub
parent
d1d79b930d
commit
fca1ddda96
@ -23527,7 +23527,8 @@ class basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-spec
|
||||
// get reference to parent of JSON pointer ptr
|
||||
const auto last_path = ptr.back();
|
||||
ptr.pop_back();
|
||||
basic_json& parent = result[ptr];
|
||||
// parent must exist when performing patch add per RFC6902 specs
|
||||
basic_json& parent = result.at(ptr);
|
||||
|
||||
switch (parent.m_type)
|
||||
{
|
||||
|
Reference in New Issue
Block a user