mirror of
https://git.salome-platform.org/gitpub/modules/smesh.git
synced 2025-01-14 10:40:34 +05:00
Call 'Location' with correct indices only to avoid exception.
This commit is contained in:
parent
436838c202
commit
866063cabb
@ -258,10 +258,12 @@ void SMESH_NoteBook::ReplaceVariables()
|
|||||||
// Get the entry of object storing "StringAttribute"
|
// Get the entry of object storing "StringAttribute"
|
||||||
TCollection_AsciiString & cmdStr = aCmd->GetString();
|
TCollection_AsciiString & cmdStr = aCmd->GetString();
|
||||||
TEntry2VarVecMap::iterator ent2varVec;
|
TEntry2VarVecMap::iterator ent2varVec;
|
||||||
if (int pos = cmdStr.Location( SMESH::TVar::ObjPrefix(), 6, cmdStr.Length() ))
|
Standard_Integer fromIndex = 6;
|
||||||
|
Standard_Integer cmdLen = cmdStr.Length();
|
||||||
|
if ( int pos = (fromIndex <= cmdLen) ? cmdStr.Location( SMESH::TVar::ObjPrefix(), fromIndex, cmdLen ) : 0 )
|
||||||
{
|
{
|
||||||
TCollection_AsciiString varHolderEntry =
|
TCollection_AsciiString varHolderEntry =
|
||||||
cmdStr.SubString( pos + strlen( SMESH::TVar::ObjPrefix() ), cmdStr.Length() );
|
cmdStr.SubString( pos + strlen( SMESH::TVar::ObjPrefix() ), cmdLen );
|
||||||
ent2varVec = _entry2VarsMap.find( varHolderEntry );
|
ent2varVec = _entry2VarsMap.find( varHolderEntry );
|
||||||
cmdStr.Split( pos - 1 );
|
cmdStr.Split( pos - 1 );
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user