From 76ac46b16fd92d0fb444f786d4946424d9029315 Mon Sep 17 00:00:00 2001 From: jpr Date: Thu, 21 Apr 2011 09:14:31 +0000 Subject: [PATCH] avoid segfault when unaware user sets SplitOnly to true, and the asks for ImageDataVector --- vtk/vtkGdcm4DSplitter.cxx | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/vtk/vtkGdcm4DSplitter.cxx b/vtk/vtkGdcm4DSplitter.cxx index 85a71d1e..9cd0bfc9 100644 --- a/vtk/vtkGdcm4DSplitter.cxx +++ b/vtk/vtkGdcm4DSplitter.cxx @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: vtkGdcm4DSplitter.cxx,v $ Language: C++ - Date: $Date: 2011/04/20 15:03:54 $ - Version: $Revision: 1.13 $ + Date: $Date: 2011/04/21 09:14:31 $ + Version: $Revision: 1.14 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -360,7 +360,7 @@ void vtkGdcm4DSplitter::setRecursive(bool recursive) std::vector *vtkGdcm4DSplitter::GetVectGdcmFileLists() { if (SplitOnly) - return NULL; + return &VectGdcmFileLists; GDCM_NAME_SPACE::XCoherentFileSetmap::iterator it; for ( it = xcm.begin(); @@ -483,6 +483,9 @@ std::cout << l->size() << " gdcm::File read" << std::endl; std::cout << xcm.size() << " XCoherent entries found" << std::endl; } +// put here, to avoid segfault when unaware user sets SplitOnly to true, and the asks for ImageDataVector +ImageDataVector = new std::vector; + std::cout <<"SplitOnly " << SplitOnly << std::endl; if(SplitOnly) return true; @@ -490,7 +493,7 @@ std::cout <<"SplitOnly " << SplitOnly << std::endl; // // ------------------------------------------------------------ // - ImageDataVector = new std::vector; +// ImageDataVector = new std::vector; /// \TODO move inside the loop, or be clever using vtk! // vtkGdcmReader *reader = vtkGdcmReader::New(); // move inside the loop, or be clever using vtk! -- 2.45.0