changeset 4695:651f069c7f77

fix error if overriding existing tag in the DICOM dictionary
author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 17 Jun 2021 14:00:34 +0200
parents da1edb7d6332
children dd6274412ff4
files OrthancFramework/Sources/DicomParsing/FromDcmtkBridge.cpp
diffstat 1 files changed, 8 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/OrthancFramework/Sources/DicomParsing/FromDcmtkBridge.cpp	Wed Jun 16 17:37:47 2021 +0200
+++ b/OrthancFramework/Sources/DicomParsing/FromDcmtkBridge.cpp	Thu Jun 17 14:00:34 2021 +0200
@@ -452,13 +452,17 @@
     {
       DictionaryLocker locker;
 
-      if (locker->findEntry(name.c_str()))
+      if (locker->findEntry(DcmTagKey(tag.GetGroup(), tag.GetElement()),
+                            privateCreator.empty() ? NULL : privateCreator.c_str()))
       {
         throw OrthancException(ErrorCode_AlreadyExistingTag,
-                               "Cannot register two tags with the same symbolic name \"" + name + "\"");
+                               "Cannot register twice the tag (" + tag.Format() +
+                               "), whose symbolic name is \"" + name + "\"");
       }
-
-      locker->addEntry(entry.release());
+      else
+      {
+        locker->addEntry(entry.release());
+      }
     }
   }