Undefined check in serializer utils

Summary:
Release notes: none

`proto` should be checked before being accessed, not sure why Flow didn't pick up on this one either. This bug occurred only during UFI code, but it unblocks the work there.
Closes https://github.com/facebook/prepack/pull/1610

Differential Revision: D7315572

Pulled By: trueadm

fbshipit-source-id: 8989d70952e9017501f4d261e648f371b96cad24
This commit is contained in:
Dominic Gannaway 2018-03-17 03:19:13 -07:00 committed by Facebook Github Bot
parent ba29f3c7e1
commit 92d6fee5c8

View File

@ -119,7 +119,7 @@ export function getObjectPrototypeMetadata(realm: Realm, obj: ObjectValue) {
if (obj.$IsClassPrototype) {
skipPrototype = true;
}
if (proto.$IsClassPrototype) {
if (proto && proto.$IsClassPrototype) {
invariant(proto instanceof ObjectValue);
// we now need to check if the prototpe has a constructor
if (proto.properties.has("constructor")) {