]> SALOME platform Git repositories - plugins/ghs3dprlplugin.git/commitdiff
Salome HOME
Additional protection in method Evaluate().
authorskl <skl@opencascade.com>
Tue, 25 Aug 2009 07:48:38 +0000 (07:48 +0000)
committerskl <skl@opencascade.com>
Tue, 25 Aug 2009 07:48:38 +0000 (07:48 +0000)
src/GHS3DPRLPlugin/GHS3DPRLPlugin_GHS3DPRL.cxx

index cc801dc867aa444f1fbac41ccd87eda3df45742a..bae42d68ea3152fbb341eefb95acbc96104dce40 100755 (executable)
@@ -645,6 +645,12 @@ bool GHS3DPRLPlugin_GHS3DPRL::Evaluate(SMESH_Mesh& aMesh,
     TopoDS_Face F = TopoDS::Face( exp.Current() );
     SMESH_subMesh *sm = aMesh.GetSubMesh(F);
     MapShapeNbElemsItr anIt = aResMap.find(sm);
+    if( anIt==aResMap.end() ) {
+      SMESH_ComputeErrorPtr& smError = sm->GetComputeError();
+      smError.reset( new SMESH_ComputeError(COMPERR_ALGO_FAILED,
+                                           "Submesh can not be evaluated",this));
+      return false;
+    }
     std::vector<int> aVec = (*anIt).second;
     nbtri += Max(aVec[SMDSEntity_Triangle],aVec[SMDSEntity_Quad_Triangle]);
     nbqua += Max(aVec[SMDSEntity_Quadrangle],aVec[SMDSEntity_Quad_Quadrangle]);