Fix crash in Assets.getAsset() when callback undefined

This commit is contained in:
David Rowe 2019-08-29 13:33:04 +12:00
parent a9fe2bf415
commit 746f97a0e0

View file

@ -249,8 +249,11 @@ void AssetScriptingInterface::getAsset(QScriptValue options, QScriptValue scope,
QString("Invalid responseType: '%1' (expected: %2)").arg(responseType).arg(RESPONSE_TYPES.join(" | ")));
Promise fetched = jsPromiseReady(makePromise("fetched"), scope, callback);
Promise mapped = makePromise("mapped");
if (!fetched) {
return;
}
Promise mapped = makePromise("mapped");
mapped->fail(fetched);
mapped->then([=](QVariantMap result) {
QString hash = result.value("hash").toString();