Consider a NetworkClipLoader resource with null URL to be failed

This commit is contained in:
Simon Walton 2019-06-19 15:02:16 -07:00
parent ff1d828aaa
commit 7701710aa5
2 changed files with 8 additions and 2 deletions

View file

@ -18,7 +18,13 @@
using namespace recording;
NetworkClipLoader::NetworkClipLoader(const QUrl& url) :
Resource(url),
_clip(std::make_shared<NetworkClip>(url)) {}
_clip(std::make_shared<NetworkClip>(url)) {
if (url.isEmpty()) {
_loaded = false;
_startedLoading = false;
_failedToLoad = true;
}
}
void NetworkClip::init(const QByteArray& clipData) {
_clipData = clipData;

View file

@ -93,7 +93,7 @@ void RecordingScriptingInterface::loadRecording(const QString& url, QScriptValue
// when clip load fails, call the callback with the URL and failure boolean
connect(clipLoader.data(), &recording::NetworkClipLoader::failed, callback.engine(), [this, weakClipLoader, url, callback](QNetworkReply::NetworkError error) mutable {
qCDebug(scriptengine) << "Failed to load recording from" << url;
qCDebug(scriptengine) << "Failed to load recording from\"" << url << '"';
if (callback.isFunction()) {
QScriptValueList args { false, url };