Showing the changes to libraries/script-engine/src/AssetScriptingInterface.cpp (1 of 1321 files). Show all
Unified · Split
| @@ -132,6 +132,9 @@ void AssetScriptingInterface::setBakingEnabled(QString path, bool enabled, QScri · 131 unmodified lines | ||
| 132 | 132 | auto setBakingEnabledRequest = DependencyManager::get<AssetClient>()->createSetBakingEnabledRequest({ path }, enabled); |
| 133 | 133 | |
| 134 | 134 | Promise deferred = jsPromiseReady(makePromise(__FUNCTION__), thisObject(), callback); |
| 135 | + if (!deferred) { | |
| 136 | + return; | |
| 137 | + } | |
| 135 | 138 | |
| 136 | 139 | connect(setBakingEnabledRequest, &SetBakingEnabledRequest::finished, setBakingEnabledRequest, [deferred](SetBakingEnabledRequest* request) { |
| 137 | 140 | Q_ASSERT(QThread::currentThread() == request->thread()); |
| @@ -265,8 +268,11 @@ void AssetScriptingInterface::getAsset(QScriptValue options, QScriptValue scope, · 127 unmodified lines | ||
| 265 | 268 | QString("Invalid responseType: '%1' (expected: %2)").arg(responseType).arg(RESPONSE_TYPES.join(" | "))); |
| 266 | 269 | |
| 267 | 270 | Promise fetched = jsPromiseReady(makePromise("fetched"), scope, callback); |
| 268 | − Promise mapped = makePromise("mapped"); | |
| 271 | + if (!fetched) { | |
| 272 | + return; | |
| 273 | + } | |
| 269 | 274 | |
| 275 | + Promise mapped = makePromise("mapped"); | |
| 270 | 276 | mapped->fail(fetched); |
| 271 | 277 | mapped->then([=](QVariantMap result) { |
| 272 | 278 | QString hash = result.value("hash").toString(); |