From: vsr Date: Tue, 22 Nov 2011 11:25:59 +0000 (+0000) Subject: Fix crash in DumpPython if cannot cast Driver to the Component X-Git-Tag: V6_4_0~6 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=f6d0f2b59c4cc61731c9475c1e23f96f21bd4c0b;p=modules%2Fkernel.git Fix crash in DumpPython if cannot cast Driver to the Component --- diff --git a/src/SALOMEDS/SALOMEDS_Driver_i.cxx b/src/SALOMEDS/SALOMEDS_Driver_i.cxx index 187c526f2..b366d9f0a 100644 --- a/src/SALOMEDS/SALOMEDS_Driver_i.cxx +++ b/src/SALOMEDS/SALOMEDS_Driver_i.cxx @@ -292,14 +292,20 @@ SALOMEDSImpl_TMPFile* SALOMEDS_Driver_i::DumpPython(SALOMEDSImpl_Study* theStudy { SALOMEDS_Study_i * st_servant = SALOMEDS_Study_i::GetStudyServant(theStudy, _orb);//new SALOMEDS_Study_i (theStudy, _orb); SALOMEDS::Study_var st = SALOMEDS::Study::_narrow(st_servant->_this()); - Engines::EngineComponent_ptr aComponent = Engines::EngineComponent::_narrow(_driver); SALOMEDS::unlock(); - CORBA::Boolean aValidScript, aPublished = isPublished; - Engines::TMPFile_var aStream = aComponent->DumpPython(st.in(), aPublished, isMultiFile, aValidScript); + + Engines::TMPFile_var aStream; + CORBA::Boolean aValidScript = true; // VSR: maybe should be false by default ??? + + Engines::EngineComponent_ptr aComponent = Engines::EngineComponent::_narrow(_driver); + if ( !CORBA::is_nil( aComponent ) ) + aStream = aComponent->DumpPython(st.in(), isPublished, isMultiFile, aValidScript); + SALOMEDSImpl_TMPFile* aTMPFile = new Engines_TMPFile_i(aStream._retn()); theStreamLength = aTMPFile->Size(); isValidScript = aValidScript; + SALOMEDS::lock(); return aTMPFile;