From dbbd8a2dbee2a8ad0a41f0d01d280c25ab6a7e9f Mon Sep 17 00:00:00 2001 From: eap Date: Fri, 31 Jul 2020 20:27:23 +0300 Subject: [PATCH] Protection for the case of python command wrapped over several lines --- src/SMESH_I/SMESH_2smeshpy.cxx | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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 ); } -- 2.30.2