diff --git a/src/node_object_wrap.h b/src/node_object_wrap.h index 534567b2e76..ccb1eb8c256 100644 --- a/src/node_object_wrap.h +++ b/src/node_object_wrap.h @@ -13,9 +13,12 @@ class ObjectWrap { } virtual ~ObjectWrap ( ) { - handle_->SetInternalField(0, v8::Undefined()); - handle_.Dispose(); - handle_.Clear(); + if (!handle_.IsEmpty()) { + assert(handle_.IsNearDeath()); + handle_->SetInternalField(0, v8::Undefined()); + handle_.Dispose(); + handle_.Clear(); + } } template