From bc9f6e5f17b61a5ed7c69799854cf30a553fe355 Mon Sep 17 00:00:00 2001 From: ana Date: Tue, 8 Feb 2011 07:45:38 +0000 Subject: [PATCH] Fix for the bug IPAL22164: Fatal error during save/load a SMESH study --- src/SALOMEDSImpl/SALOMEDSImpl_StudyBuilder.cxx | 5 ++++- src/TOOLSDS/SALOMEDS_Tool.cxx | 1 + 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_StudyBuilder.cxx b/src/SALOMEDSImpl/SALOMEDSImpl_StudyBuilder.cxx index d42e08dfc..60d9ff07e 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_StudyBuilder.cxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_StudyBuilder.cxx @@ -360,9 +360,12 @@ bool SALOMEDSImpl_StudyBuilder::LoadWith(const SALOMEDSImpl_SComponent& anSCO, std::string aDir = SALOMEDSImpl_Tool::GetDirFromPath(Res); - bool aResult = (ASCIIfileState[0]=='A')? + bool aResult = true; + if(aStreamFile && aStreamSize > 0 ) { + aResult = (ASCIIfileState[0]=='A')? aDriver->LoadASCII(anSCO, aStreamFile, aStreamSize, aDir.c_str(), aMultifileState[0]=='M'): aDriver->Load(anSCO, aStreamFile, aStreamSize, aDir.c_str(), aMultifileState[0]=='M'); + } if(aStreamFile != NULL) delete []aStreamFile; diff --git a/src/TOOLSDS/SALOMEDS_Tool.cxx b/src/TOOLSDS/SALOMEDS_Tool.cxx index b1b269454..52f8c5013 100644 --- a/src/TOOLSDS/SALOMEDS_Tool.cxx +++ b/src/TOOLSDS/SALOMEDS_Tool.cxx @@ -213,6 +213,7 @@ namespace aNbFiles++; } + if ( aNbFiles == 0 ) return (new SALOMEDS::TMPFile); aBufferSize += 4; //4 bytes for a number of the files that will be written to the stream; unsigned char* aBuffer = new unsigned char[aBufferSize]; if(aBuffer == NULL) -- 2.39.2