diff options
author | Edward Welbourne <edward.welbourne@qt.io> | 2019-07-17 12:30:37 +0200 |
---|---|---|
committer | Edward Welbourne <edward.welbourne@qt.io> | 2019-07-17 12:53:07 +0200 |
commit | 3f35535a350224b04999ea1f7dae0a3e4c49f0ff (patch) | |
tree | b30c2fbb60b8db82a9958efa8da4de89fcbe8e87 /src/qml | |
parent | f3b1568d05d6c31137aae186d2928fef0faba9b1 (diff) | |
parent | 4129028e25da7f42bacba68ce14ccf44d03ff59b (diff) |
Merge "Merge remote-tracking branch 'origin/5.12' into 5.12-merge-5.13"
Diffstat (limited to 'src/qml')
-rw-r--r-- | src/qml/qml/qqmlxmlhttprequest.cpp | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/src/qml/qml/qqmlxmlhttprequest.cpp b/src/qml/qml/qqmlxmlhttprequest.cpp index 9f629f974d..9877cc027f 100644 --- a/src/qml/qml/qqmlxmlhttprequest.cpp +++ b/src/qml/qml/qqmlxmlhttprequest.cpp @@ -1574,7 +1574,8 @@ void QQmlXMLHttpRequest::dispatchCallbackNow(Object *thisObj, bool done, bool er if (scope.engine->hasException) { QQmlError error = scope.engine->catchExceptionAsQmlError(); - QQmlEnginePrivate::warning(QQmlEnginePrivate::get(scope.engine->qmlEngine()), error); + QQmlEnginePrivate *qmlEnginePrivate = scope.engine->qmlEngine() ? QQmlEnginePrivate::get(scope.engine->qmlEngine()) : nullptr; + QQmlEnginePrivate::warning(qmlEnginePrivate, error); } }; @@ -1765,8 +1766,13 @@ ReturnedValue QQmlXMLHttpRequestCtor::method_open(const FunctionObject *b, const // Argument 1 - URL QUrl url = QUrl(argv[1].toQStringNoThrow()); - if (url.isRelative()) - url = scope.engine->callingQmlContext()->resolvedUrl(url); + if (url.isRelative()) { + QQmlContextData *qmlContextData = scope.engine->callingQmlContext(); + if (qmlContextData) + url = qmlContextData->resolvedUrl(url); + else + url = scope.engine->resolvedUrl(url.url()); + } bool async = true; // Argument 2 - async (optional) |