From 5b4b620d8b2a36f5e76ffbca16a2d3d5d7253c45 Mon Sep 17 00:00:00 2001 From: Alex Beregszaszi Date: Sat, 6 May 2017 17:47:08 +0100 Subject: Do not crash on AST if parsing failed --- libsolidity/interface/CompilerStack.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/libsolidity/interface/CompilerStack.cpp b/libsolidity/interface/CompilerStack.cpp index 9c9c9614..c4e60fd7 100644 --- a/libsolidity/interface/CompilerStack.cpp +++ b/libsolidity/interface/CompilerStack.cpp @@ -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; } -- cgit v1.2.3