Skip to content

Commit

Permalink
handle emptry return and documentation str
Browse files Browse the repository at this point in the history
  • Loading branch information
0xalpharush committed Mar 13, 2023
1 parent b3b13e8 commit a091e8c
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions slither/solc_parsing/ast/compact_json.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,11 @@ def _extract_decl_props(raw: Dict) -> Dict:
documentation = None
if "documentation" in raw and raw["documentation"]:
if "text" in raw["documentation"]:
documentation = raw["documentation"]["text"]
documentation = (
raw["documentation"]
if isinstance(raw["documentation"], str)
else raw["documentation"]["text"]
)
else:
documentation = raw["documentation"]
assert isinstance(documentation, str)
Expand Down Expand Up @@ -604,7 +608,7 @@ def parse_return(raw: Dict) -> Return:
functionReturnParameters (int)
"""
expr_parsed = None
if "expression" in raw:
if "expression" in raw and raw["expression"]:
expr_parsed = parse(raw["expression"])

return Return(expression=expr_parsed, **_extract_base_props(raw))
Expand Down

0 comments on commit a091e8c

Please sign in to comment.