Salome HOME
Feature #102: Display of Lambert coordinates.
[modules/hydro.git] / src / HYDROGUI / HYDROGUI_PolylineOp.cxx
index 1a95430469bd6e52ae0e1a95289e2118a77bbfc5..7ad2b2f6c9c746fa22d722e042fcd7bdca8342ed 100755 (executable)
@@ -194,6 +194,12 @@ bool HYDROGUI_PolylineOp::processApply( int& theUpdateFlags,
     }
   }
 
+  if ( myCurve->getNbSections() <= 0 )
+  {
+    theErrorMsg = tr( "EMPTY_POLYLINE_DATA" );
+    return false;
+  }
+
   Handle(HYDROData_PolylineXY) aPolylineObj;
   if( myIsEdit )
   {
@@ -208,7 +214,7 @@ bool HYDROGUI_PolylineOp::processApply( int& theUpdateFlags,
   if( aPolylineObj.IsNull() )
     return false;
 
-  aPolylineObj->SetName(aPolylineName);
+  aPolylineObj->SetName( aPolylineName );
 
   for ( int i = 0 ; i < myCurve->getNbSections() ; i++ )
   {
@@ -225,6 +231,13 @@ bool HYDROGUI_PolylineOp::processApply( int& theUpdateFlags,
 
     // Add the points fro section
     CurveCreator::Coordinates aCurveCoords = myCurve->getPoints( i );
+
+    if ( aCurveCoords.size() <= 2 )
+    {
+      theErrorMsg = tr( "NUMBER_OF_SECTION_POINTS_INCORRECT" );
+      return false;
+    }
+
     for ( int k = 0 ; k + 1 < aCurveCoords.size() ; k++ )
     {
       HYDROData_PolylineXY::Point aSectPoint;