aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/jsruntime/qv4stringobject.cpp
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@qt.io>2018-05-04 10:52:44 +0200
committerLars Knoll <lars.knoll@qt.io>2018-05-04 18:13:09 +0000
commit8e69a9868cfa6f9b054d056dc74e97fbc77f8171 (patch)
tree811de3f47b4e83fafda669739564514d6da3bb88 /src/qml/jsruntime/qv4stringobject.cpp
parent798b8d6368dcbcd9b797dad54d87ca0880ad6fb4 (diff)
Avoid accessing an object with this == nullptr
Get rid of a circular dependency when initializing StringObject.prototype, by setting it's string value later during the initialization process. Change-Id: I5bdaff3936c1f8af12c4d53f95747b8aa43f4ef6 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'src/qml/jsruntime/qv4stringobject.cpp')
-rw-r--r--src/qml/jsruntime/qv4stringobject.cpp1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/qml/jsruntime/qv4stringobject.cpp b/src/qml/jsruntime/qv4stringobject.cpp
index 2c0d1fdbad..f6c365e4da 100644
--- a/src/qml/jsruntime/qv4stringobject.cpp
+++ b/src/qml/jsruntime/qv4stringobject.cpp
@@ -177,6 +177,7 @@ void StringPrototype::init(ExecutionEngine *engine, Object *ctor)
Heap::InternalClass *ic = scope.engine->classes[ExecutionEngine::Class_StringObject]->changePrototype(scope.engine->objectPrototype()->d());
d()->internalClass.set(scope.engine, ic);
d()->string.set(scope.engine, scope.engine->id_empty()->d());
+ setProperty(scope.engine, Heap::StringObject::LengthPropertyIndex, Primitive::fromInt32(0));
ctor->defineReadonlyProperty(engine->id_prototype(), (o = this));
ctor->defineReadonlyProperty(engine->id_length(), Primitive::fromInt32(1));