summaryrefslogtreecommitdiffstats
path: root/common/facadefactory.h
diff options
context:
space:
mode:
Diffstat (limited to 'common/facadefactory.h')
-rw-r--r--common/facadefactory.h7
1 files changed, 6 insertions, 1 deletions
diff --git a/common/facadefactory.h b/common/facadefactory.h
index 83b8898..03e0784 100644
--- a/common/facadefactory.h
+++ b/common/facadefactory.h
@@ -77,7 +77,12 @@ public:
77 std::shared_ptr<StoreFacade<DomainType>> getFacade(const QByteArray &resource, const QByteArray &instanceIdentifier) 77 std::shared_ptr<StoreFacade<DomainType>> getFacade(const QByteArray &resource, const QByteArray &instanceIdentifier)
78 { 78 {
79 const QByteArray typeName = ApplicationDomain::getTypeName<DomainType>(); 79 const QByteArray typeName = ApplicationDomain::getTypeName<DomainType>();
80 return std::static_pointer_cast<StoreFacade<DomainType>>(getFacade(resource, instanceIdentifier, typeName)); 80 const auto ptr = getFacade(resource, instanceIdentifier, typeName);
81 //We have to check the pointer before the cast, otherwise a check would return true also for invalid instances.
82 if (!ptr) {
83 return std::shared_ptr<StoreFacade<DomainType>>();
84 }
85 return std::static_pointer_cast<StoreFacade<DomainType>>(ptr);
81 } 86 }
82 87
83private: 88private: