mirror of
https://github.com/overte-org/overte.git
synced 2025-04-21 09:44:21 +02:00
Merge pull request #6443 from ZappoMan/assetJS
fix crash with no asset server
This commit is contained in:
commit
eef01f8a13
1 changed files with 6 additions and 6 deletions
|
@ -369,6 +369,11 @@ void AssetClient::handleNodeKilled(SharedNodePointer node) {
|
|||
void AssetScriptingInterface::uploadData(QString data, QString extension, QScriptValue callback) {
|
||||
QByteArray dataByteArray = data.toUtf8();
|
||||
auto upload = DependencyManager::get<AssetClient>()->createUpload(dataByteArray, extension);
|
||||
if (!upload) {
|
||||
qCWarning(asset_client) << "Error uploading file to asset server";
|
||||
return;
|
||||
}
|
||||
|
||||
QObject::connect(upload, &AssetUpload::finished, this, [callback, extension](AssetUpload* upload, const QString& hash) mutable {
|
||||
if (callback.isFunction()) {
|
||||
QString url = "atp://" + hash + "." + extension;
|
||||
|
@ -376,8 +381,6 @@ void AssetScriptingInterface::uploadData(QString data, QString extension, QScrip
|
|||
callback.call(QScriptValue(), args);
|
||||
}
|
||||
});
|
||||
|
||||
// start the upload now
|
||||
upload->start();
|
||||
}
|
||||
|
||||
|
@ -423,7 +426,4 @@ void AssetScriptingInterface::downloadData(QString urlString, QScriptValue callb
|
|||
});
|
||||
|
||||
assetRequest->start();
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
Loading…
Reference in a new issue