changeset 7006:83fc150a2183

protect calls to ServerContext::GetIngestTranscoding()
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 07 Jul 2026 10:29:05 +0200
parents 8e440add1d47
children 4c8f52f67af0
files OrthancServer/Sources/ServerContext.cpp OrthancServer/Sources/ServerContext.h
diffstat 2 files changed, 14 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/OrthancServer/Sources/ServerContext.cpp	Mon Jul 06 17:13:35 2026 +0200
+++ b/OrthancServer/Sources/ServerContext.cpp	Tue Jul 07 10:29:05 2026 +0200
@@ -616,6 +616,19 @@
   }
 
 
+  std::string ServerContext::GetIngestTranscoding() const
+  {
+    if (isIngestTranscoding_)
+    {
+      return GetTransferSyntaxUid(ingestTransferSyntax_);
+    }
+    else
+    {
+      throw OrthancException(ErrorCode_BadSequenceOfCalls);
+    }
+  }
+
+
   void ServerContext::SetCompressionEnabled(bool enabled)
   {
     if (enabled)
--- a/OrthancServer/Sources/ServerContext.h	Mon Jul 06 17:13:35 2026 +0200
+++ b/OrthancServer/Sources/ServerContext.h	Tue Jul 07 10:29:05 2026 +0200
@@ -336,10 +336,7 @@
       return patientLevelEnabled_;
     }
 
-    std::string GetIngestTranscoding() const
-    {
-      return GetTransferSyntaxUid(ingestTransferSyntax_);
-    }
+    std::string GetIngestTranscoding() const;
 
     void SetCompressionEnabled(bool enabled);