Do not crash on AST if parsing failed

This commit is contained in:
Alex Beregszaszi 2017-05-06 17:47:08 +01:00
parent a6586f7504
commit 5b4b620d8b

View File

@ -503,6 +503,9 @@ Scanner const& CompilerStack::scanner(string const& _sourceName) const
SourceUnit const& CompilerStack::ast(string const& _sourceName) const
{
if (m_stackState < ParsingSuccessful)
BOOST_THROW_EXCEPTION(CompilerError() << errinfo_comment("Parsing was not successful."));
return *source(_sourceName).ast;
}