LLL: do not crash if import callback is null

This commit is contained in:
Alex Beregszaszi 2017-10-03 10:22:30 +01:00
parent 37365478c1
commit ab206b8113

View File

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