Skip to content

Commit

Permalink
Fix memory access errors
Browse files Browse the repository at this point in the history
In this case, an empty-looking nestedObjectRef, but in severe cases,
segfaults and the like.
  • Loading branch information
iFreilicht committed Mar 27, 2024
1 parent cdb7da0 commit e081b14
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ const nlohmann::json & valueAt(const nlohmann::json & map, const std::string & k
{
return map[key];
}
const nlohmann::json & valueAt(const nlohmann::json::object_t & map, const std::string & key)
{
return map.at(key);
}

const nlohmann::json::object_t & getObjectRef(const nlohmann::json & obj)
{
Expand Down

0 comments on commit e081b14

Please sign in to comment.