diff Framework/Radiography/RadiographyWidget.cpp @ 1258:9c20ae049669

more logs to debug exceptions in Render
author Alain Mazy <alain@mazy.be>
date Tue, 14 Jan 2020 15:22:10 +0100
parents 771913258728
children 2d8ab34c8c91
line wrap: on
line diff
--- a/Framework/Radiography/RadiographyWidget.cpp	Tue Jan 14 12:05:01 2020 +0100
+++ b/Framework/Radiography/RadiographyWidget.cpp	Tue Jan 14 15:22:10 2020 +0100
@@ -76,6 +76,11 @@
     {
       floatBuffer_.reset(new Orthanc::Image(
         Orthanc::PixelFormat_Float32, width, height, false));
+
+      if (floatBuffer_.get() == NULL)
+      {
+        throw Orthanc::OrthancException(Orthanc::ErrorCode_NotEnoughMemory, "RadiographyWidget::RenderInternal: unable to allocate float buffer");
+      }
     }
 
     if (cairoBuffer_.get() == NULL ||
@@ -83,6 +88,11 @@
         cairoBuffer_->GetHeight() != height)
     {
       cairoBuffer_.reset(new CairoSurface(width, height, false /* no alpha */));
+
+      if (cairoBuffer_.get() == NULL)
+      {
+        throw Orthanc::OrthancException(Orthanc::ErrorCode_NotEnoughMemory, "RadiographyWidget::RenderInternal: unable to allocate cairo buffer");
+      }
     }
 
     RenderBackground(*floatBuffer_, 0.0, 65535.0);