1
0
Fork 0
mirror of https://github.com/rubyjs/therubyracer synced 2023-03-27 23:21:42 -04:00

add guards to satisfy v8 assertions

This commit is contained in:
Charles Lowell 2012-08-01 00:59:48 +03:00
parent 59154c2e2b
commit e038c0c301

View file

@ -31,7 +31,7 @@ namespace rr {
this->deleter = unwrap(wrapper, 3); this->deleter = unwrap(wrapper, 3);
this->enumerator = unwrap(wrapper, 4); this->enumerator = unwrap(wrapper, 4);
v8::Handle<v8::Value> data = wrapper->Get(5); v8::Handle<v8::Value> data = wrapper->Get(5);
if (!data.IsEmpty()) { if (!data.IsEmpty() && !data->IsNull() && !data->IsUndefined()) {
this->data = Value(data); this->data = Value(data);
} }
} }
@ -57,7 +57,7 @@ namespace rr {
VALUE Accessor::unwrap(v8::Handle<v8::Object> wrapper, int index) { VALUE Accessor::unwrap(v8::Handle<v8::Object> wrapper, int index) {
v8::Handle<v8::Value> value = wrapper->Get(index); v8::Handle<v8::Value> value = wrapper->Get(index);
if (value.IsEmpty()) { if (value.IsEmpty() || !value->IsExternal()) {
return Qnil; return Qnil;
} else { } else {
v8::Handle<v8::External> external(v8::External::Cast(*value)); v8::Handle<v8::External> external(v8::External::Cast(*value));