aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/jsruntime/qv4lookup.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/qml/jsruntime/qv4lookup.cpp')
-rw-r--r--src/qml/jsruntime/qv4lookup.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/qml/jsruntime/qv4lookup.cpp b/src/qml/jsruntime/qv4lookup.cpp
index 99f425293e..0cda6b864a 100644
--- a/src/qml/jsruntime/qv4lookup.cpp
+++ b/src/qml/jsruntime/qv4lookup.cpp
@@ -77,8 +77,13 @@ ReturnedValue Lookup::resolvePrimitiveGetter(ExecutionEngine *engine, const Valu
primitiveLookup.type = object.type();
switch (primitiveLookup.type) {
case Value::Undefined_Type:
- case Value::Null_Type:
- return engine->throwTypeError();
+ case Value::Null_Type: {
+ Scope scope(engine);
+ ScopedString name(scope, engine->currentStackFrame->v4Function->compilationUnit->runtimeStrings[nameIndex]);
+ const QString message = QStringLiteral("Cannot read property '%1' of %2").arg(name->toQString())
+ .arg(QLatin1String(primitiveLookup.type == Value::Undefined_Type ? "undefined" : "null"));
+ return engine->throwTypeError(message);
+ }
case Value::Boolean_Type:
primitiveLookup.proto = engine->booleanPrototype()->d();
break;