瀏覽代碼

Prohibit tag copying to yourself in ctkDICOMDataset

Marco Nolden 13 年之前
父節點
當前提交
4b91626010
共有 1 個文件被更改,包括 4 次插入0 次删除
  1. 4 0
      Libs/DICOM/Core/ctkDICOMDataset.cpp

+ 4 - 0
Libs/DICOM/Core/ctkDICOMDataset.cpp

@@ -293,6 +293,10 @@ bool ctkDICOMDataset::CopyElement( DcmDataset* dataset, const DcmTagKey& tag, in
   bool copied(true);
 
   if (!dataset) return false;
+  if (dataset == d->m_DcmDataset)
+  {
+    throw std::logic_error("Trying to copy tag to yourself. Please check application logic!"); 
+  }
 
   // type 1 or 1C must exist AND have a value
   if (!dataset->tagExistsWithValue( tag ))