Check internal field before converting

This commit is contained in:
Cheng Zhao 2015-02-11 22:09:42 +08:00
parent 1116a36c15
commit 3387f33a8e

View file

@ -67,6 +67,8 @@ void* FromV8Impl(v8::Isolate* isolate, v8::Handle<v8::Value> val) {
if (!val->IsObject()) if (!val->IsObject())
return NULL; return NULL;
v8::Handle<v8::Object> obj = v8::Handle<v8::Object>::Cast(val); v8::Handle<v8::Object> obj = v8::Handle<v8::Object>::Cast(val);
if (obj->InternalFieldCount() != 1)
return NULL;
return MATE_GET_INTERNAL_FIELD_POINTER(obj, 0); return MATE_GET_INTERNAL_FIELD_POINTER(obj, 0);
} }