Salome HOME
merge master
[modules/hydro.git] / src / HYDROData / HYDROData_PolylineOperator.cxx
index 6dbbd74562279b6c59b9958cf67c250f233b92e2..b991bf7f6992a0728f13c55e2e93e11940eb3cea 100644 (file)
@@ -306,9 +306,12 @@ bool HYDROData_PolylineOperator::CreatePolylines( const Handle( HYDROData_Docume
     if( isUseIndices )
     {
       QString aNewName = theNamePrefix + "_" + QString::number( anIndex );
-      if( theDoc->FindObjectByName( aNewName ).IsNull() )  // the object with such a name is not found
-        aPolyline->SetName( aNewName );
-      anIndex++;
+      while( !theDoc->FindObjectByName( aNewName ).IsNull() )  // the object with such a name is not found
+      {
+        anIndex++;
+        aNewName = theNamePrefix + "_" + QString::number( anIndex );
+      }
+      aPolyline->SetName( aNewName );
     }
     else
     {