diff Core/DicomFormat/DicomImageInformation.cpp @ 2416:feb0d2dcfa9b

try and fix compiler bugs
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 03 Oct 2017 10:30:06 +0200
parents 16e45af17a4d
children 5a7c5c541a1d
line wrap: on
line diff
--- a/Core/DicomFormat/DicomImageInformation.cpp	Mon Oct 02 22:02:05 2017 +0200
+++ b/Core/DicomFormat/DicomImageInformation.cpp	Tue Oct 03 10:30:06 2017 +0200
@@ -178,18 +178,20 @@
       throw OrthancException(ErrorCode_NotImplemented);
     }
 
-    try
-    {
-      numberOfFrames_ = boost::lexical_cast<unsigned int>(values.GetValue(DICOM_TAG_NUMBER_OF_FRAMES).GetContent());
-    }
-    catch (OrthancException&)
+    if (values.HasTag(DICOM_TAG_NUMBER_OF_FRAMES))
     {
-      // If the tag "NumberOfFrames" is absent, assume there is a single frame
-      numberOfFrames_ = 1;
+      try
+      {
+        numberOfFrames_ = boost::lexical_cast<unsigned int>(values.GetValue(DICOM_TAG_NUMBER_OF_FRAMES).GetContent());
+      }
+      catch (boost::bad_lexical_cast&)
+      {
+        throw OrthancException(ErrorCode_NotImplemented);
+      }
     }
-    catch (boost::bad_lexical_cast&)
+    else
     {
-      throw OrthancException(ErrorCode_NotImplemented);
+      numberOfFrames_ = 1;
     }
 
     if ((bitsAllocated_ != 8 && bitsAllocated_ != 16 &&