Skip to content

Commit

Permalink
Handle if crytic-compile returns an empty ast (#1961)
Browse files Browse the repository at this point in the history
  • Loading branch information
smonicas authored Jun 15, 2023
1 parent 7cb7cb9 commit ccad542
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions slither/solc_parsing/slither_compilation_unit_solc.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,13 @@ def _parse_enum(self, top_level_data: Dict, filename: str) -> None:

# pylint: disable=too-many-branches,too-many-statements,too-many-locals
def parse_top_level_from_loaded_json(self, data_loaded: Dict, filename: str) -> None:
if not data_loaded or data_loaded is None:
logger.error(
"crytic-compile returned an empty AST. "
"If you are trying to analyze a contract from etherscan or similar make sure it has source code available."
)
return

if "nodeType" in data_loaded:
self._is_compact_ast = True

Expand Down

0 comments on commit ccad542

Please sign in to comment.