mirror of
https://github.com/bytecodealliance/wasm-micro-runtime.git
synced 2025-03-12 08:55:28 +00:00
wasm_cluster_spread_custom_data: Fix a crash when called before exec (#1257)
This commit is contained in:
parent
d5d6b7284d
commit
2b49a0b817
|
@ -937,12 +937,18 @@ wasm_cluster_spread_custom_data(WASMModuleInstanceCommon *module_inst,
|
|||
void *custom_data)
|
||||
{
|
||||
WASMExecEnv *exec_env = wasm_clusters_search_exec_env(module_inst);
|
||||
WASMCluster *cluster = NULL;
|
||||
bh_assert(exec_env);
|
||||
|
||||
cluster = wasm_exec_env_get_cluster(exec_env);
|
||||
bh_assert(cluster);
|
||||
if (exec_env == NULL) {
|
||||
/* Maybe threads have not been started yet. */
|
||||
wasm_runtime_set_custom_data_internal(module_inst, custom_data);
|
||||
}
|
||||
else {
|
||||
WASMCluster *cluster;
|
||||
|
||||
traverse_list(&cluster->exec_env_list, set_custom_data_visitor,
|
||||
custom_data);
|
||||
cluster = wasm_exec_env_get_cluster(exec_env);
|
||||
bh_assert(cluster);
|
||||
|
||||
traverse_list(&cluster->exec_env_list, set_custom_data_visitor,
|
||||
custom_data);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user