Fix segfault.

This commit is contained in:
Daniel Kirchner 2023-01-05 18:26:49 +01:00
parent 54bdaeee39
commit 469d6d4d29

View File

@ -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 ? &currentContract.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 ? &currentContract.evmRuntimeAssembly->codeSections().front().items : nullptr;
}