Merge pull request #3012 from ethereum/lll-includes

LLL: do not crash if import callback is null
This commit is contained in:
Alex Beregszaszi 2017-10-03 11:35:31 +01:00 committed by GitHub
commit 9e101db45f

View File

@ -224,6 +224,8 @@ void CodeFragment::constructOperation(sp::utree const& _t, CompilerState& _s)
string fileName = firstAsString(); string fileName = firstAsString();
if (fileName.empty()) if (fileName.empty())
error<InvalidName>("Empty file name provided"); error<InvalidName>("Empty file name provided");
if (!m_readFile)
error<InvalidName>("Import callback not present");
string contents = m_readFile(fileName); string contents = m_readFile(fileName);
if (contents.empty()) if (contents.empty())
error<InvalidName>(std::string("File not found (or empty): ") + fileName); error<InvalidName>(std::string("File not found (or empty): ") + fileName);