changeset 6310:72f74eba36fb

error when trying to extract a frame from a file without pixel data
author Alain Mazy <am@orthanc.team>
date Fri, 12 Sep 2025 12:33:19 +0200
parents 1f07e38a804f
children e90b9d76ff6d
files OrthancFramework/Sources/DicomParsing/ParsedDicomFile.cpp
diffstat 1 files changed, 5 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/OrthancFramework/Sources/DicomParsing/ParsedDicomFile.cpp	Fri Sep 12 11:28:12 2025 +0200
+++ b/OrthancFramework/Sources/DicomParsing/ParsedDicomFile.cpp	Fri Sep 12 12:33:19 2025 +0200
@@ -1694,6 +1694,11 @@
                                     MimeType& mime,
                                     unsigned int frameId) const
   {
+    if (!this->HasTag(DICOM_TAG_PIXEL_DATA))
+    {
+      throw OrthancException(ErrorCode_BadRequest, "Cannot extract a frame from a DIOCM file that does not have pixel data.");
+    }
+
     if (pimpl_->frameIndex_.get() == NULL)
     {
       assert(pimpl_->file_ != NULL &&