From 0aee555ae75e51802e5193c96b2e492007a15a52 Mon Sep 17 00:00:00 2001 From: Christian Mollekopf Date: Fri, 1 May 2015 23:48:33 +0200 Subject: Guard against non available facades. --- common/clientapi.h | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'common') 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: .template each([query, resultSet](const QByteArray &resource, Async::Future &future) { //TODO pass resource identifier to factory auto facade = FacadeFactory::instance().getFacade(resource); - facade->load(query, resultSet).template then([&future](){future.setFinished();}).exec(); - //Keep the facade alive for the lifetime of the resultSet. - resultSet->setFacade(facade); + if (facade) { + facade->load(query, resultSet).template then([&future](){future.setFinished();}).exec(); + //Keep the facade alive for the lifetime of the resultSet. + resultSet->setFacade(facade); + } else { + qWarning() << "Could not find facade for resource " << resource; + //Ignore the error and carry on + future.setFinished(); + } }).template then([query, resultSet]() { resultSet->initialResultSetComplete(); if (!query.liveQuery) { -- cgit v1.2.3