Skip to content

Commit 33263c1

Browse files
committed
fix(instance) Set @memory to nil if none is exported.
1 parent 2f15bfd commit 33263c1

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/instance/mod.rs

+4-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ use crate::{
1313
};
1414
use lazy_static::lazy_static;
1515
use rutie::{
16-
class, methods, wrappable_struct, AnyException, AnyObject, Exception, Module, Object, RString,
16+
class, methods, wrappable_struct, AnyException, AnyObject, Exception, Module, NilClass, Object,
17+
RString,
1718
};
1819
use std::rc::Rc;
1920
use wasmer_runtime::{self as runtime, imports, Export};
@@ -96,6 +97,8 @@ methods!(
9697
.get_nested_class("Memory")
9798
.wrap_data(exported_memory, &*MEMORY_WRAPPER);
9899
ruby_instance.instance_variable_set("@memory", ruby_exported_memory);
100+
} else {
101+
ruby_instance.instance_variable_set("@memory", NilClass::new());
99102
}
100103

101104
Ok(ruby_instance)

0 commit comments

Comments
 (0)