diff --git a/libsolidity/interface/CompilerStack.cpp b/libsolidity/interface/CompilerStack.cpp index cacfc95aa..52bd54d16 100644 --- a/libsolidity/interface/CompilerStack.cpp +++ b/libsolidity/interface/CompilerStack.cpp @@ -765,7 +765,8 @@ evmasm::AssemblyItems const* CompilerStack::assemblyItems(string const& _contrac solThrow(CompilerError, "Compilation was not successful."); Contract const& currentContract = contract(_contractName); - solAssert(currentContract.evmAssembly->codeSections().size() == 1, "Expected a single code section in legacy codegen."); + if (currentContract.evmAssembly) + solAssert(currentContract.evmAssembly->codeSections().size() == 1, "Expected a single code section in legacy codegen."); return currentContract.evmAssembly ? ¤tContract.evmAssembly->codeSections().front().items : nullptr; } @@ -775,7 +776,8 @@ evmasm::AssemblyItems const* CompilerStack::runtimeAssemblyItems(string const& _ solThrow(CompilerError, "Compilation was not successful."); Contract const& currentContract = contract(_contractName); - solAssert(currentContract.evmRuntimeAssembly->codeSections().size() == 1, "Expected a single code section in legacy codegen."); + if (currentContract.evmRuntimeAssembly) + solAssert(currentContract.evmRuntimeAssembly->codeSections().size() == 1, "Expected a single code section in legacy codegen."); return currentContract.evmRuntimeAssembly ? ¤tContract.evmRuntimeAssembly->codeSections().front().items : nullptr; }