summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Mollekopf <chrigi_1@fastmail.fm>2015-05-01 23:48:33 +0200
committerChristian Mollekopf <chrigi_1@fastmail.fm>2015-05-01 23:48:33 +0200
commit0aee555ae75e51802e5193c96b2e492007a15a52 (patch)
tree4809d8c16690c37589160bcb2dc0d588201b8a83
parentd04b873e5341e2e3009f59f71a7210fe1b2b519d (diff)
downloadsink-0aee555ae75e51802e5193c96b2e492007a15a52.tar.gz
sink-0aee555ae75e51802e5193c96b2e492007a15a52.zip
Guard against non available facades.
-rw-r--r--common/clientapi.h12
1 files changed, 9 insertions, 3 deletions
diff --git a/common/clientapi.h b/common/clientapi.h
index 4650221..1bd8bdc 100644
--- a/common/clientapi.h
+++ b/common/clientapi.h
@@ -345,9 +345,15 @@ public:
345 .template each<void, QByteArray>([query, resultSet](const QByteArray &resource, Async::Future<void> &future) { 345 .template each<void, QByteArray>([query, resultSet](const QByteArray &resource, Async::Future<void> &future) {
346 //TODO pass resource identifier to factory 346 //TODO pass resource identifier to factory
347 auto facade = FacadeFactory::instance().getFacade<DomainType>(resource); 347 auto facade = FacadeFactory::instance().getFacade<DomainType>(resource);
348 facade->load(query, resultSet).template then<void>([&future](){future.setFinished();}).exec(); 348 if (facade) {
349 //Keep the facade alive for the lifetime of the resultSet. 349 facade->load(query, resultSet).template then<void>([&future](){future.setFinished();}).exec();
350 resultSet->setFacade(facade); 350 //Keep the facade alive for the lifetime of the resultSet.
351 resultSet->setFacade(facade);
352 } else {
353 qWarning() << "Could not find facade for resource " << resource;
354 //Ignore the error and carry on
355 future.setFinished();
356 }
351 }).template then<void>([query, resultSet]() { 357 }).template then<void>([query, resultSet]() {
352 resultSet->initialResultSetComplete(); 358 resultSet->initialResultSetComplete();
353 if (!query.liveQuery) { 359 if (!query.liveQuery) {