Fix a missing early-return in Table::get (#1652)
Turns out this was a typo from #1016!
This commit is contained in:
@@ -216,7 +216,7 @@ pub(crate) fn from_checked_anyfunc(
|
|||||||
store: &Store,
|
store: &Store,
|
||||||
) -> Val {
|
) -> Val {
|
||||||
if item.type_index == wasmtime_runtime::VMSharedSignatureIndex::default() {
|
if item.type_index == wasmtime_runtime::VMSharedSignatureIndex::default() {
|
||||||
Val::AnyRef(AnyRef::Null);
|
return Val::AnyRef(AnyRef::Null);
|
||||||
}
|
}
|
||||||
let instance_handle = unsafe { wasmtime_runtime::InstanceHandle::from_vmctx(item.vmctx) };
|
let instance_handle = unsafe { wasmtime_runtime::InstanceHandle::from_vmctx(item.vmctx) };
|
||||||
let export = wasmtime_runtime::ExportFunction {
|
let export = wasmtime_runtime::ExportFunction {
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ mod linker;
|
|||||||
mod memory_creator;
|
mod memory_creator;
|
||||||
mod name;
|
mod name;
|
||||||
mod stack_overflow;
|
mod stack_overflow;
|
||||||
|
mod table;
|
||||||
mod traps;
|
mod traps;
|
||||||
mod use_after_drop;
|
mod use_after_drop;
|
||||||
mod wast;
|
mod wast;
|
||||||
|
|||||||
13
tests/all/table.rs
Normal file
13
tests/all/table.rs
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
use wasmtime::*;
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn get_none() {
|
||||||
|
let store = Store::default();
|
||||||
|
let ty = TableType::new(ValType::FuncRef, Limits::new(1, None));
|
||||||
|
let table = Table::new(&store, ty, Val::AnyRef(AnyRef::Null)).unwrap();
|
||||||
|
match table.get(0) {
|
||||||
|
Some(Val::AnyRef(AnyRef::Null)) => {}
|
||||||
|
_ => panic!(),
|
||||||
|
}
|
||||||
|
assert!(table.get(1).is_none());
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user