create empty handle for null or undefined value
This commit is contained in:
parent
b5e5de626c
commit
70092b493e
1 changed files with 4 additions and 0 deletions
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue