diff options
Diffstat (limited to 'gin/wrappable.cc')
-rw-r--r-- | gin/wrappable.cc | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/gin/wrappable.cc b/gin/wrappable.cc index 09c17a3..27c58df 100644 --- a/gin/wrappable.cc +++ b/gin/wrappable.cc @@ -49,10 +49,10 @@ v8::Local<v8::Object> WrappableBase::GetWrapperImpl(v8::Isolate* isolate, data->SetObjectTemplate(info, templ); } CHECK_EQ(kNumberOfInternalFields, templ->InternalFieldCount()); - v8::Local<v8::Object> wrapper = templ->NewInstance(); + v8::Local<v8::Object> wrapper; // |wrapper| may be empty in some extreme cases, e.g., when // Object.prototype.constructor is overwritten. - if (wrapper.IsEmpty()) { + if (!templ->NewInstance(isolate->GetCurrentContext()).ToLocal(&wrapper)) { // The current wrappable object will be no longer managed by V8. Delete this // now. delete this; |