mirror of
https://github.com/mii443/wasmer.git
synced 2025-12-10 22:58:18 +00:00
No longer causing a panic when globals are set to null in JS
This commit is contained in:
10
lib/api/src/js/externals/global.rs
vendored
10
lib/api/src/js/externals/global.rs
vendored
@@ -70,19 +70,19 @@ impl Global {
|
|||||||
let ty = self.handle.ty;
|
let ty = self.handle.ty;
|
||||||
let raw = match ty.ty {
|
let raw = match ty.ty {
|
||||||
Type::I32 => RawValue {
|
Type::I32 => RawValue {
|
||||||
i32: value.as_f64().unwrap() as _,
|
i32: value.as_f64().unwrap_or_default() as _,
|
||||||
},
|
},
|
||||||
Type::I64 => RawValue {
|
Type::I64 => RawValue {
|
||||||
i64: value.as_f64().unwrap() as _,
|
i64: value.as_f64().unwrap_or_default() as _,
|
||||||
},
|
},
|
||||||
Type::F32 => RawValue {
|
Type::F32 => RawValue {
|
||||||
f32: value.as_f64().unwrap() as _,
|
f32: value.as_f64().unwrap_or_default() as _,
|
||||||
},
|
},
|
||||||
Type::F64 => RawValue {
|
Type::F64 => RawValue {
|
||||||
f64: value.as_f64().unwrap(),
|
f64: value.as_f64().unwrap_or_default(),
|
||||||
},
|
},
|
||||||
Type::V128 => RawValue {
|
Type::V128 => RawValue {
|
||||||
u128: value.as_f64().unwrap() as _,
|
u128: value.as_f64().unwrap_or_default() as _,
|
||||||
},
|
},
|
||||||
Type::FuncRef => {
|
Type::FuncRef => {
|
||||||
unimplemented!();
|
unimplemented!();
|
||||||
|
|||||||
Reference in New Issue
Block a user