Skip to content

Commit

Permalink
Try #493:
Browse files Browse the repository at this point in the history
  • Loading branch information
bors[bot] committed Jun 12, 2019
2 parents 8f3cc5f + 81d8e4e commit 7b4e2b0
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions lib/runtime-c-api/src/module.rs
Original file line number Diff line number Diff line change
Expand Up @@ -129,14 +129,14 @@ pub unsafe extern "C" fn wasmer_module_instantiate(
}

let module = &*(module as *const Module);
let new_instance = if let Ok(res) = module.instantiate(&import_object) {
res
} else {
update_last_error(CApiError {
msg: "error instantiating from module".to_string(),
});
return wasmer_result_t::WASMER_ERROR;
let new_instance = match module.instantiate(&import_object) {
Ok(instance) => instance,
Err(error) => {
update_last_error(error);
return wasmer_result_t::WASMER_ERROR;
}
};

*instance = Box::into_raw(Box::new(new_instance)) as *mut wasmer_instance_t;
wasmer_result_t::WASMER_OK
}
Expand Down

0 comments on commit 7b4e2b0

Please sign in to comment.