From: ana Date: Tue, 8 Feb 2011 07:45:38 +0000 (+0000) Subject: Fix for the bug IPAL22164: Fatal error during save/load a SMESH study X-Git-Tag: Start_BR_19998_21191~76 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=bc9f6e5f17b61a5ed7c69799854cf30a553fe355;p=modules%2Fkernel.git Fix for the bug IPAL22164: Fatal error during save/load a SMESH study --- 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)