diff OrthancServer/OrthancInitialization.cpp @ 1366:a3559b66fba7 query-retrieve

move primitives
author Sebastien Jodogne <s.jodogne@gmail.com>
date Fri, 22 May 2015 16:17:28 +0200
parents 59b603763f43
children 52b2070fc8f1
line wrap: on
line diff
--- a/OrthancServer/OrthancInitialization.cpp	Thu May 21 17:03:15 2015 +0200
+++ b/OrthancServer/OrthancInitialization.cpp	Fri May 22 16:17:28 2015 +0200
@@ -238,7 +238,8 @@
   {
     boost::mutex::scoped_lock lock(globalMutex_);
 
-    if (configuration_->isMember(parameter))
+    if (configuration_.get() != NULL &&
+        configuration_->isMember(parameter))
     {
       return (*configuration_) [parameter].asString();
     }
@@ -254,7 +255,8 @@
   {
     boost::mutex::scoped_lock lock(globalMutex_);
 
-    if (configuration_->isMember(parameter))
+    if (configuration_.get() != NULL &&
+        configuration_->isMember(parameter))
     {
       return (*configuration_) [parameter].asInt();
     }
@@ -270,7 +272,8 @@
   {
     boost::mutex::scoped_lock lock(globalMutex_);
 
-    if (configuration_->isMember(parameter))
+    if (configuration_.get() != NULL &&
+        configuration_->isMember(parameter))
     {
       return (*configuration_) [parameter].asBool();
     }
@@ -286,6 +289,11 @@
   {
     boost::mutex::scoped_lock lock(globalMutex_);
 
+    if (configuration_.get() == NULL)
+    {
+      throw OrthancException(ErrorCode_InexistentItem);
+    }
+       
     if (!configuration_->isMember("DicomModalities"))
     {
       throw OrthancException(ErrorCode_BadFileFormat);
@@ -318,6 +326,11 @@
   {
     boost::mutex::scoped_lock lock(globalMutex_);
 
+    if (configuration_.get() == NULL)
+    {
+      throw OrthancException(ErrorCode_InexistentItem);
+    }
+       
     if (!configuration_->isMember("OrthancPeers"))
     {
       throw OrthancException(ErrorCode_BadFileFormat);
@@ -352,7 +365,8 @@
 
     target.clear();
   
-    if (!configuration_->isMember(parameter))
+    if (configuration_.get() == NULL ||
+        !configuration_->isMember(parameter))
     {
       return true;
     }
@@ -409,7 +423,8 @@
 
     httpServer.ClearUsers();
 
-    if (!configuration_->isMember("RegisteredUsers"))
+    if (configuration_.get() == NULL ||
+        !configuration_->isMember("RegisteredUsers"))
     {
       return;
     }
@@ -470,7 +485,8 @@
 
     target.clear();
   
-    if (!configuration_->isMember(key))
+    if (configuration_.get() == NULL ||
+        !configuration_->isMember(key))
     {
       return;
     }
@@ -571,6 +587,11 @@
   {
     boost::mutex::scoped_lock lock(globalMutex_);
 
+    if (configuration_.get() == NULL)
+    {
+      throw OrthancException(ErrorCode_InternalError);
+    }
+
     if (!configuration_->isMember("DicomModalities"))
     {
       (*configuration_) ["DicomModalities"] = Json::objectValue;
@@ -594,6 +615,11 @@
   {
     boost::mutex::scoped_lock lock(globalMutex_);
 
+    if (configuration_.get() == NULL)
+    {
+      throw OrthancException(ErrorCode_InternalError);
+    }
+
     if (!configuration_->isMember("DicomModalities"))
     {
       throw OrthancException(ErrorCode_BadFileFormat);
@@ -614,6 +640,11 @@
   {
     boost::mutex::scoped_lock lock(globalMutex_);
 
+    if (configuration_.get() == NULL)
+    {
+      throw OrthancException(ErrorCode_InternalError);
+    }
+
     if (!configuration_->isMember("OrthancPeers"))
     {
       (*configuration_) ["OrthancPeers"] = Json::objectValue;
@@ -637,6 +668,11 @@
   {
     boost::mutex::scoped_lock lock(globalMutex_);
 
+    if (configuration_.get() == NULL)
+    {
+      throw OrthancException(ErrorCode_InternalError);
+    }
+
     if (!configuration_->isMember("OrthancPeers"))
     {
       throw OrthancException(ErrorCode_BadFileFormat);