summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/node_object_wrap.h9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/node_object_wrap.h b/src/node_object_wrap.h
index 534567b2e7..ccb1eb8c25 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 <class T>