diff Plugins/Engine/OrthancPlugins.cpp @ 1842:697ae8d0e287

better handling of ordered-slices
author Sebastien Jodogne <s.jodogne@gmail.com>
date Mon, 30 Nov 2015 13:16:52 +0100
parents 859224214616
children d10a8164da5f
line wrap: on
line diff
--- a/Plugins/Engine/OrthancPlugins.cpp	Mon Nov 30 12:05:55 2015 +0100
+++ b/Plugins/Engine/OrthancPlugins.cpp	Mon Nov 30 13:16:52 2015 +0100
@@ -1964,7 +1964,14 @@
       case _OrthancPluginService_GetImageBuffer:
       {
         const _OrthancPluginGetImageInfo& p = *reinterpret_cast<const _OrthancPluginGetImageInfo*>(parameters);
-        *(p.resultBuffer) = reinterpret_cast<const ImageAccessor*>(p.image)->GetBuffer();
+        const ImageAccessor& image = reinterpret_cast<const ImageAccessor&>(p.image);
+
+        if (image.IsReadOnly())
+        {
+          throw OrthancException(ErrorCode_ReadOnly);
+        }
+
+        *(p.resultBuffer) = image.GetBuffer();
         return true;
       }