]> SALOME platform Git repositories - modules/kernel.git/commitdiff
Salome HOME
Fix for the bug IPAL22164: Fatal error during save/load a SMESH study
authorana <ana@opencascade.com>
Tue, 8 Feb 2011 07:45:38 +0000 (07:45 +0000)
committerana <ana@opencascade.com>
Tue, 8 Feb 2011 07:45:38 +0000 (07:45 +0000)
src/SALOMEDSImpl/SALOMEDSImpl_StudyBuilder.cxx
src/TOOLSDS/SALOMEDS_Tool.cxx

index d42e08dfc77ac7ff553649d0e06a3ab5186536cc..60d9ff07e768415b41ac0e4816152172859d3219 100644 (file)
@@ -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; 
 
index b1b2694542fcefabccba783380571d766487be69..52f8c50132ee6bf4b62b163e97ff055ff605e1c7 100644 (file)
@@ -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)