summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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) {