History

Fix crash in Assets.getAsset() when callback undefined

David Rowe committed 7 years ago

Commit 746f97a1 parent a9fe2bf1 file · +4 −1Browse files

Showing the changes to libraries/script-engine/src/AssetScriptingInterface.cpp (1 of 1 file). Show all

Unified · Split

libraries/script-engine/src/AssetScriptingInterface.cpp+4−1
@@ -249,8 +249,11 @@ void AssetScriptingInterface::getAsset(QScriptValue options, QScriptValue scope, · 248 unmodified lines
249 QString("Invalid responseType: '%1' (expected: %2)").arg(responseType).arg(RESPONSE_TYPES.join(" | ")));249 QString("Invalid responseType: '%1' (expected: %2)").arg(responseType).arg(RESPONSE_TYPES.join(" | ")));
250 250
251 Promise fetched = jsPromiseReady(makePromise("fetched"), scope, callback);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 mapped->fail(fetched);257 mapped->fail(fetched);
255 mapped->then([=](QVariantMap result) {258 mapped->then([=](QVariantMap result) {
256 QString hash = result.value("hash").toString();259 QString hash = result.value("hash").toString();