Browse Source

Avoid assert on ill-formed group/element strings

Steve Pieper 13 years ago
parent
commit
03a9827437
1 changed files with 4 additions and 0 deletions
  1. 4 0
      Libs/DICOM/Core/ctkDICOMDatabase.cpp

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

@@ -780,6 +780,10 @@ bool ctkDICOMDatabase::tagToGroupElement(const QString tag, unsigned short& grou
 {
 {
   QStringList groupElement = tag.split(",");
   QStringList groupElement = tag.split(",");
   bool groupOK, elementOK;
   bool groupOK, elementOK;
+  if (groupElement.length() != 2)
+    {
+    return false;
+    }
   group = groupElement[0].toUInt(&groupOK, 16);
   group = groupElement[0].toUInt(&groupOK, 16);
   element = groupElement[1].toUInt(&elementOK, 16);
   element = groupElement[1].toUInt(&elementOK, 16);