diff --git a/mythril/mythx/__init__.py b/mythril/mythx/__init__.py index ae105470..3f2b9616 100644 --- a/mythril/mythx/__init__.py +++ b/mythril/mythx/__init__.py @@ -79,8 +79,10 @@ def analyze(contracts: List[SolidityContract], analysis_mode: str = "quick") -> issue = Issue( contract=contract.name, function_name=None, - address=issue.locations[0].source_map.components[0].offset, - swc_id=issue.swc_id[4:], # remove 'SWC-' prefix + address=issue.locations[0].source_map.components[0].offset + if issue.locations + else -1, + swc_id=issue.swc_id[4:] or "None", # remove 'SWC-' prefix title=issue.swc_title, bytecode=contract.creation_code, severity=issue.severity.capitalize(), diff --git a/mythril/solidity/soliditycontract.py b/mythril/solidity/soliditycontract.py index 534189d3..772141c8 100644 --- a/mythril/solidity/soliditycontract.py +++ b/mythril/solidity/soliditycontract.py @@ -56,15 +56,15 @@ def get_contracts_from_file(input_file, solc_settings_json=None, solc_binary="so ) try: - for contractName in data["contracts"][input_file].keys(): + for contract_name in data["contracts"][input_file].keys(): if len( - data["contracts"][input_file][contractName]["evm"]["deployedBytecode"][ + data["contracts"][input_file][contract_name]["evm"]["deployedBytecode"][ "object" ] ): yield SolidityContract( input_file=input_file, - name=contractName, + name=contract_name, solc_settings_json=solc_settings_json, solc_binary=solc_binary, )