Salome HOME
fix AddFrom() for an undefined filter as argument
authoreap <eap@opencascade.com>
Mon, 17 Feb 2014 13:08:46 +0000 (17:08 +0400)
committereap <eap@opencascade.com>
Mon, 17 Feb 2014 13:08:46 +0000 (17:08 +0400)
src/SMESH_I/SMESH_Group_i.cxx

index 76dae46734525895a5d4f03339a742e0e1c7cb07..1b7dbd5eab268d904ad81608371791bd720bd756 100644 (file)
@@ -411,9 +411,9 @@ CORBA::Long SMESH_Group_i::AddFrom( SMESH::SMESH_IDSource_ptr theSource )
   long prevNb = Size();
   SMESHDS_Group* aGroupDS = dynamic_cast<SMESHDS_Group*>( GetGroupDS() );
   if (aGroupDS) {
-    SMDS_ElemIteratorPtr elemIt = SMESH_Mesh_i::GetElements( theSource, GetType() );
-    while ( elemIt->more() )
-      aGroupDS->SMDSGroup().Add( elemIt->next() );
+    if ( SMDS_ElemIteratorPtr elemIt = SMESH_Mesh_i::GetElements( theSource, GetType() ))
+      while ( elemIt->more() )
+        aGroupDS->SMDSGroup().Add( elemIt->next() );
   }
 
   // Update Python script