From: eap Date: Fri, 31 Jul 2020 17:27:23 +0000 (+0300) Subject: Protection for the case of python command wrapped over several lines X-Git-Tag: V9_6_0a1~16 X-Git-Url: http://git.salome-platform.org/gitweb/?p=modules%2Fsmesh.git;a=commitdiff_plain;h=dbbd8a2dbee2a8ad0a41f0d01d280c25ab6a7e9f;ds=inline Protection for the case of python command wrapped over several lines --- diff --git a/src/SMESH_I/SMESH_2smeshpy.cxx b/src/SMESH_I/SMESH_2smeshpy.cxx index 9ad385290..b36b31c13 100644 --- a/src/SMESH_I/SMESH_2smeshpy.cxx +++ b/src/SMESH_I/SMESH_2smeshpy.cxx @@ -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 ); }