Salome HOME
Protection for the case of python command wrapped over several lines
[modules/smesh.git] / src / SMESH_I / SMESH_2smeshpy.cxx
index 689f498618521b4240972cf51e5ad9dd3c505a48..b36b31c13ea6f5d95e6836ef8329aeba6a9ed0f3 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2007-2019  CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2020  CEA/DEN, EDF R&D, OPEN CASCADE
 //
 // Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
@@ -2495,7 +2495,7 @@ void _pyMeshEditor::Process( const Handle(_pyCommand)& theCommand)
       "ExtrusionByNormal", "ExtrusionSweepObject2D","ExtrusionAlongPath","ExtrusionAlongPathObject",
       "ExtrusionAlongPathX","ExtrusionAlongPathObject1D","ExtrusionAlongPathObject2D",
       "ExtrusionSweepObjects","RotationSweepObjects","ExtrusionAlongPathObjects",
-      "Mirror","MirrorObject","Translate","TranslateObject","Rotate","RotateObject",
+      "Mirror","MirrorObject","Translate","TranslateObject","Rotate","RotateObject","Offset",
       "FindCoincidentNodes","MergeNodes","FindEqualElements","FillHole",
       "MergeElements","MergeEqualElements","SewFreeBorders","SewConformFreeBorders",
       "FindCoincidentFreeBorders", "SewCoincidentFreeBorders",
@@ -3939,7 +3939,7 @@ int _pyCommand::GetArgBeginning() const
   if ( pos == UNKNOWN )
   {
     pos = GetBegPos( METHOD_IND ) + myMeth.Length();
-    if ( pos < 1 )
+    if ( pos < 1 && Length() >= 4 )
       pos = myString.Location( "(", 4, Length() ); // 4 = strlen("b.c(")
   }
   return pos;
@@ -4024,6 +4024,11 @@ TCollection_AsciiString _pyCommand::GetWord( const _AString & theString,
   }
   theStartPos = beg;
   //cout << theString << " ---- " << beg << " - " << end << endl;
+  if ( end > theString.Length() )
+  {
+    theStartPos = EMPTY;
+    return theEmptyString;
+  }
   return theString.SubString( beg, end );
 }