rust: add assertion for evmc_context.host

This commit is contained in:
Alex Beregszaszi 2019-07-25 14:50:06 +01:00
parent ff40c5983b
commit 5ee58d181d
1 changed files with 1 additions and 0 deletions

View File

@ -173,6 +173,7 @@ impl ExecutionMessage {
impl<'a> ExecutionContext<'a> { impl<'a> ExecutionContext<'a> {
pub fn new(_context: &'a mut ffi::evmc_context) -> Self { pub fn new(_context: &'a mut ffi::evmc_context) -> Self {
assert!(_context.host != std::ptr::null());
let _tx_context = unsafe { let _tx_context = unsafe {
assert!((*(_context.host)).get_tx_context.is_some()); assert!((*(_context.host)).get_tx_context.is_some());
(*(_context.host)).get_tx_context.unwrap()(_context as *mut ffi::evmc_context) (*(_context.host)).get_tx_context.unwrap()(_context as *mut ffi::evmc_context)