mirror of
https://github.com/fluencelabs/wasmer
synced 2025-06-15 18:01:22 +00:00
fix(runtime-c-api) wasmer_instance_context_data_set
does nothing if instance
is null.
This commit is contained in:
@ -428,8 +428,13 @@ pub extern "C" fn wasmer_instance_context_data_set(
|
|||||||
instance: *mut wasmer_instance_t,
|
instance: *mut wasmer_instance_t,
|
||||||
data_ptr: *mut c_void,
|
data_ptr: *mut c_void,
|
||||||
) {
|
) {
|
||||||
let instance_ref = unsafe { &mut *(instance as *mut Instance) };
|
if instance.is_null() {
|
||||||
instance_ref.context_mut().data = data_ptr;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
let instance = unsafe { &mut *(instance as *mut Instance) };
|
||||||
|
|
||||||
|
instance.context_mut().data = data_ptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Gets the memory within the context at the index `memory_idx`.
|
/// Gets the memory within the context at the index `memory_idx`.
|
||||||
|
Reference in New Issue
Block a user