feat(c-api) More functions handle null pointers.

This commit is contained in:
Ivan Enderlin
2020-11-12 15:45:48 +01:00
parent 0ce3b27da1
commit 5db1ab7c37
2 changed files with 15 additions and 6 deletions

View File

@@ -210,6 +210,8 @@ pub unsafe extern "C" fn wasm_func_result_arity(func: &wasm_func_t) -> usize {
}
#[no_mangle]
pub extern "C" fn wasm_func_type(func: &wasm_func_t) -> Box<wasm_functype_t> {
Box::new(wasm_functype_t::new(func.inner.ty().clone()))
pub extern "C" fn wasm_func_type(func: Option<&wasm_func_t>) -> Option<Box<wasm_functype_t>> {
let func = func?;
Some(Box::new(wasm_functype_t::new(func.inner.ty().clone())))
}