diff --git a/js/src/builtin/TypedObject.cpp b/js/src/builtin/TypedObject.cpp index cf87ccf244d6..e9f98d96aec6 100644 --- a/js/src/builtin/TypedObject.cpp +++ b/js/src/builtin/TypedObject.cpp @@ -894,8 +894,12 @@ StructMetaTypeDescr::layout(JSContext *cx, // fieldTypes : { string: Type, ... } RootedObject fieldOffsets(cx); fieldOffsets = NewObjectWithProto(cx, nullptr, nullptr, TenuredObject); + if (!fieldOffsets) + return false; RootedObject fieldTypes(cx); fieldTypes = NewObjectWithProto(cx, nullptr, nullptr, TenuredObject); + if (!fieldTypes) + return false; for (size_t i = 0; i < typeRepr->fieldCount(); i++) { const StructField &field = typeRepr->field(i); RootedId fieldId(cx, NameToId(field.propertyName));