Skip to content

Commit

Permalink
Fix compare function in Json ABI::generate(ContractDefinition const& …
Browse files Browse the repository at this point in the history
…_contractDef).
  • Loading branch information
aarlt committed Feb 20, 2024
1 parent b8d2e5b commit 37c997e
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion libsolidity/interface/ABI.cpp
Expand Up @@ -41,7 +41,9 @@ bool anyDataStoredInStorage(TypePointers const& _pointers)
Json ABI::generate(ContractDefinition const& _contractDef)
{
auto compare = [](Json const& _a, Json const& _b) -> bool {
return std::make_tuple(_a["type"], _a["name"]) < std::make_tuple(_b["type"], _b["name"]);
if (_a.contains("type") && _a.contains("name") && _b.contains("type") && _b.contains("name"))
return std::make_tuple(_a["type"], _a["name"]) < std::make_tuple(_b["type"], _b["name"]);
return false;
};
std::multiset<Json, decltype(compare)> abi(compare);

Expand Down

0 comments on commit 37c997e

Please sign in to comment.