Merge pull request #7 from deepak1556/empty_handle_converter_patch

create empty handle for null value
This commit is contained in:
Kevin Sawicki 2016-12-12 12:55:31 -08:00 committed by GitHub
commit 6b7e73db92

View file

@ -48,6 +48,10 @@ struct Converter<mate::Handle<T> > {
static bool FromV8(v8::Isolate* isolate, v8::Local<v8::Value> val, static bool FromV8(v8::Isolate* isolate, v8::Local<v8::Value> val,
mate::Handle<T>* out) { mate::Handle<T>* out) {
T* object = NULL; T* object = NULL;
if (val->IsNull() || val->IsUndefined()) {
*out = mate::Handle<T>();
return true;
}
if (!Converter<T*>::FromV8(isolate, val, &object)) { if (!Converter<T*>::FromV8(isolate, val, &object)) {
return false; return false;
} }