diff OrthancServer/FromDcmtkBridge.cpp @ 2116:2fabd1073728

prevent registering two tags with the same symbolic name
author Sebastien Jodogne <s.jodogne@gmail.com>
date Mon, 31 Oct 2016 15:42:18 +0100
parents a657f7772e69
children b9bd52c72ba2
line wrap: on
line diff
--- a/OrthancServer/FromDcmtkBridge.cpp	Mon Oct 31 15:23:32 2016 +0100
+++ b/OrthancServer/FromDcmtkBridge.cpp	Mon Oct 31 15:42:18 2016 +0100
@@ -317,6 +317,13 @@
 
     {
       DictionaryLocker locker;
+
+      if (locker->findEntry(name.c_str()))
+      {
+        LOG(ERROR) << "Cannot register two tags with the same symbolic name \"" << name << "\"";
+        throw OrthancException(ErrorCode_AlreadyExistingTag);
+      }
+
       locker->addEntry(entry.release());
     }
   }