summaryrefslogtreecommitdiffstats
path: root/js/src/jsstr.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'js/src/jsstr.cpp')
-rw-r--r--js/src/jsstr.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/js/src/jsstr.cpp b/js/src/jsstr.cpp
index fdb62a679..74f61b87d 100644
--- a/js/src/jsstr.cpp
+++ b/js/src/jsstr.cpp
@@ -2918,7 +2918,10 @@ js::InitStringClass(JSContext* cx, HandleObject obj)
Rooted<JSString*> empty(cx, cx->runtime()->emptyString);
RootedObject proto(cx, GlobalObject::createBlankPrototype(cx, global, &StringObject::class_));
- if (!proto || !proto->as<StringObject>().init(cx, empty))
+ if (!proto)
+ return nullptr;
+ Handle<StringObject*> protoObj = proto.as<StringObject>();
+ if (!StringObject::init(cx, protoObj, empty))
return nullptr;
/* Now create the String function. */