Showing the changes to libraries/script-engine/src/AssetScriptingInterface.cpp (1 of 1 file). Show all
Unified · Split
| @@ -249,8 +249,11 @@ void AssetScriptingInterface::getAsset(QScriptValue options, QScriptValue scope, · 248 unmodified lines | ||
| 249 | 249 | QString("Invalid responseType: '%1' (expected: %2)").arg(responseType).arg(RESPONSE_TYPES.join(" | "))); |
| 250 | 250 | |
| 251 | 251 | Promise fetched = jsPromiseReady(makePromise("fetched"), scope, callback); |
| 252 | − Promise mapped = makePromise("mapped"); | |
| 252 | + if (!fetched) { | |
| 253 | + return; | |
| 254 | + } | |
| 253 | 255 | |
| 256 | + Promise mapped = makePromise("mapped"); | |
| 254 | 257 | mapped->fail(fetched); |
| 255 | 258 | mapped->then([=](QVariantMap result) { |
| 256 | 259 | QString hash = result.value("hash").toString(); |