fix: confirm a v8::Value
is a v8::Object
before casting it (#43603)
fix: confirm a v8::Value is a v8::Object before casting it Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com> Co-authored-by: Charles Kerr <charles@charleskerr.com>
This commit is contained in:
parent
5c424edcca
commit
5f97f97f7c
1 changed files with 4 additions and 4 deletions
|
@ -30,12 +30,12 @@ namespace electron {
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
bool IsValidWrappable(const v8::Local<v8::Value>& obj) {
|
bool IsValidWrappable(const v8::Local<v8::Value>& val) {
|
||||||
v8::Local<v8::Object> port = v8::Local<v8::Object>::Cast(obj);
|
if (!val->IsObject())
|
||||||
|
|
||||||
if (!port->IsObject())
|
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
v8::Local<v8::Object> port = val.As<v8::Object>();
|
||||||
|
|
||||||
if (port->InternalFieldCount() != gin::kNumberOfInternalFields)
|
if (port->InternalFieldCount() != gin::kNumberOfInternalFields)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue