mirror of
https://github.com/bytecodealliance/wasm-micro-runtime.git
synced 2025-05-09 13:16:26 +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)
|
void *custom_data)
|
||||||
{
|
{
|
||||||
WASMExecEnv *exec_env = wasm_clusters_search_exec_env(module_inst);
|
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);
|
if (exec_env == NULL) {
|
||||||
bh_assert(cluster);
|
/* 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,
|
cluster = wasm_exec_env_get_cluster(exec_env);
|
||||||
custom_data);
|
bh_assert(cluster);
|
||||||
|
|
||||||
|
traverse_list(&cluster->exec_env_list, set_custom_data_visitor,
|
||||||
|
custom_data);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user