diff OrthancFramework/Sources/DicomFormat/DicomArray.cpp @ 4692:e68edf92e5cc

C-MOVE SCP: added possible DIMSE status "Sub-operations Complete - One or more Failures"
author Sebastien Jodogne <s.jodogne@gmail.com>
date Fri, 11 Jun 2021 10:48:28 +0200
parents d9473bd5ed43
children 7053502fbf97
line wrap: on
line diff
--- a/OrthancFramework/Sources/DicomFormat/DicomArray.cpp	Thu Jun 10 12:15:38 2021 +0200
+++ b/OrthancFramework/Sources/DicomFormat/DicomArray.cpp	Fri Jun 11 10:48:28 2021 +0200
@@ -23,6 +23,8 @@
 #include "../PrecompiledHeaders.h"
 #include "DicomArray.h"
 
+#include "../OrthancException.h"
+
 #include <stdio.h>
 
 namespace Orthanc
@@ -56,7 +58,14 @@
 
   const DicomElement &DicomArray::GetElement(size_t i) const
   {
-    return *elements_[i];
+    if (i >= elements_.size())
+    {
+      throw OrthancException(ErrorCode_ParameterOutOfRange);
+    }
+    else
+    {
+      return *elements_[i];
+    }
   }