# HG changeset patch # User Sebastien Jodogne # Date 1618407237 -7200 # Node ID 8a4ce70f456a76720a182258235a76fc2d88e234 # Parent 3bc442765b88066c88f32e95193ea03e322a43de fix crash if connection to server is lost diff -r 3bc442765b88 -r 8a4ce70f456a Framework/Common/DatabaseManager.cpp --- a/Framework/Common/DatabaseManager.cpp Wed Apr 14 15:08:51 2021 +0200 +++ b/Framework/Common/DatabaseManager.cpp Wed Apr 14 15:33:57 2021 +0200 @@ -171,6 +171,19 @@ } + IDatabase& DatabaseManager::GetDatabase() + { + if (database_.get() == NULL) + { + throw Orthanc::OrthancException(Orthanc::ErrorCode_DatabaseUnavailable); + } + else + { + return *database_; + } + } + + void DatabaseManager::StartTransaction(TransactionType type) { try diff -r 3bc442765b88 -r 8a4ce70f456a Framework/Common/DatabaseManager.h --- a/Framework/Common/DatabaseManager.h Wed Apr 14 15:08:51 2021 +0200 +++ b/Framework/Common/DatabaseManager.h Wed Apr 14 15:33:57 2021 +0200 @@ -69,10 +69,7 @@ Close(); } - IDatabase& GetDatabase() - { - return *database_; - } + IDatabase& GetDatabase(); Dialect GetDialect() const {