diff --git a/js/src/builtin/RegExp.cpp b/js/src/builtin/RegExp.cpp index 235d6e8bfc..61382e6aac 100644 --- a/js/src/builtin/RegExp.cpp +++ b/js/src/builtin/RegExp.cpp @@ -99,6 +99,9 @@ js::CreateRegExpMatchResult(JSContext* cx, RegExpShared& re, // MakeIndicesArray: step 8 ArrayObject* indicesTemplate = cx->compartment()->regExps.getOrCreateMatchResultTemplateObject(cx, RegExpCompartment::ResultTemplateKind::Indices); + if (!indicesTemplate) { + return false; + } indices = NewDenseFullyAllocatedArrayWithTemplate(cx, numPairs, indicesTemplate); if (!indices) { return false;