diff options
Diffstat (limited to 'src/qml/qml/qqmlengine.cpp')
-rw-r--r-- | src/qml/qml/qqmlengine.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/qml/qml/qqmlengine.cpp b/src/qml/qml/qqmlengine.cpp index ef9fec56fb..5a20b93c2c 100644 --- a/src/qml/qml/qqmlengine.cpp +++ b/src/qml/qml/qqmlengine.cpp @@ -2391,6 +2391,12 @@ QJSValue QQmlEnginePrivate::singletonInstance<QJSValue>(const QQmlType &type) singletonInstances.convertAndInsert(v4engine(), type, &value); } else if (!siinfo->url.isEmpty()) { QQmlComponent component(q, siinfo->url, QQmlComponent::PreferSynchronous); + if (component.isError()) { + warning(component.errors()); + v4engine()->throwError(QLatin1String("Due to the preceding error(s), Singleton \"%1\" could not be loaded.").arg(QString::fromUtf8(type.typeName()))); + + return QJSValue(QJSValue::UndefinedValue); + } QObject *o = component.beginCreate(q->rootContext()); value = q->newQObject(o); singletonInstances.convertAndInsert(v4engine(), type, &value); |