Skip to content

Commit 6634f17

Browse files
committed
Fix issue with jsonpointer add
1 parent ffd7d95 commit 6634f17

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

include/jsoncons_ext/jsonpointer/jsonpointer.hpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -664,6 +664,12 @@ namespace jsonpointer {
664664
bool create_if_missing,
665665
std::error_code& ec)
666666
{
667+
if (location.empty())
668+
{
669+
root = std::forward<T>(value);
670+
return;
671+
}
672+
667673
Json* current = std::addressof(root);
668674

669675
std::basic_string<typename Json::char_type> buffer;
@@ -801,6 +807,7 @@ namespace jsonpointer {
801807
{
802808
if (location.empty())
803809
{
810+
root = std::forward<T>(value);
804811
return;
805812
}
806813
Json* current = std::addressof(root);

0 commit comments

Comments
 (0)