aboutsummaryrefslogtreecommitdiffstats
path: root/solc/CommandLineInterface.cpp
diff options
context:
space:
mode:
authorErik Kundt <bitshift@posteo.org>2018-11-28 21:32:26 +0800
committerErik Kundt <bitshift@posteo.org>2018-11-28 21:41:16 +0800
commit50351fb8e2f318998d73f8e7043a8a56c3a6c06a (patch)
tree16eae92d357f935757d07cc0a869efcfe3a25120 /solc/CommandLineInterface.cpp
parent7cbf04686442b44b41d7b24800edb8444db31092 (diff)
downloaddexon-solidity-50351fb8e2f318998d73f8e7043a8a56c3a6c06a.tar
dexon-solidity-50351fb8e2f318998d73f8e7043a8a56c3a6c06a.tar.gz
dexon-solidity-50351fb8e2f318998d73f8e7043a8a56c3a6c06a.tar.bz2
dexon-solidity-50351fb8e2f318998d73f8e7043a8a56c3a6c06a.tar.lz
dexon-solidity-50351fb8e2f318998d73f8e7043a8a56c3a6c06a.tar.xz
dexon-solidity-50351fb8e2f318998d73f8e7043a8a56c3a6c06a.tar.zst
dexon-solidity-50351fb8e2f318998d73f8e7043a8a56c3a6c06a.zip
Fixes crash on empty runtime code.
Diffstat (limited to 'solc/CommandLineInterface.cpp')
-rw-r--r--solc/CommandLineInterface.cpp16
1 files changed, 10 insertions, 6 deletions
diff --git a/solc/CommandLineInterface.cpp b/solc/CommandLineInterface.cpp
index 7f64d8ac..e2baca7f 100644
--- a/solc/CommandLineInterface.cpp
+++ b/solc/CommandLineInterface.cpp
@@ -1022,12 +1022,16 @@ void CommandLineInterface::handleAst(string const& _argStr)
map<ASTNode const*, eth::GasMeter::GasConsumption> gasCosts;
for (auto const& contract : m_compiler->contractNames())
{
- auto ret = GasEstimator::breakToStatementLevel(
- GasEstimator(m_evmVersion).structuralEstimation(*m_compiler->runtimeAssemblyItems(contract), asts),
- asts
- );
- for (auto const& it: ret)
- gasCosts[it.first] += it.second;
+ if (auto const* assemblyItems = m_compiler->runtimeAssemblyItems(contract))
+ {
+ auto ret = GasEstimator::breakToStatementLevel(
+ GasEstimator(m_evmVersion).structuralEstimation(*assemblyItems, asts),
+ asts
+ );
+ for (auto const& it: ret)
+ gasCosts[it.first] += it.second;
+ }
+
}
bool legacyFormat = !m_args.count(g_argAstCompactJson);