From: mbs Date: Wed, 17 May 2023 13:55:14 +0000 (+0100) Subject: avoid adding a shape with empty name to the myNamesShape map X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=refs%2Fheads%2Fmbs%2FStepImport;p=modules%2Fshaper.git avoid adding a shape with empty name to the myNamesShape map --- diff --git a/src/Model/Model_ResultBody.cpp b/src/Model/Model_ResultBody.cpp index 96f2aad2e..195b44af6 100644 --- a/src/Model/Model_ResultBody.cpp +++ b/src/Model/Model_ResultBody.cpp @@ -249,18 +249,18 @@ void Model_ResultBody::addShapeColor( const std::wstring& theName,std::vector theshape, +std::wstring Model_ResultBody::addShapeName(std::shared_ptr theShape, const std::wstring& theName ){ int indice = 1; std::wstringstream aName; aName << theName; - while(myNamesShape.find(aName.str()) != myNamesShape.end() ){ + while(aName.str().empty() || myNamesShape.find(aName.str()) != myNamesShape.end() ){ aName.str(L""); aName << theName << L"__" << indice; indice++; } - myNamesShape[ aName.str() ] = theshape; + myNamesShape[ aName.str() ] = theShape; return aName.str(); }