Index: src/wasm/wasm-module.cc |
diff --git a/src/wasm/wasm-module.cc b/src/wasm/wasm-module.cc |
index 0e8054a9d895657d8db9aa561d6e9c6cf9a9a96f..a9bed84e47222581b8326aa227303ba6fb089c46 100644 |
--- a/src/wasm/wasm-module.cc |
+++ b/src/wasm/wasm-module.cc |
@@ -1953,7 +1953,10 @@ class InstantiationHelper { |
// If there was no imported WebAssembly.Memory object, create one. |
Handle<JSArrayBuffer> buffer(instance->memory_buffer(), isolate_); |
memory_object = WasmMemoryObject::New( |
- isolate_, buffer, |
+ isolate_, |
+ (instance->has_memory_buffer()) |
+ ? handle(instance->memory_buffer()) |
+ : Handle<JSArrayBuffer>::null(), |
(module_->max_mem_pages != 0) ? module_->max_mem_pages : -1); |
instance->set_memory_object(*memory_object); |
} else { |