From f04af0d221c69cf4871bb794b946aee3cfc5d214 Mon Sep 17 00:00:00 2001 From: mbs Date: Wed, 17 May 2023 14:55:14 +0100 Subject: [PATCH] avoid adding a shape with empty name to the myNamesShape map --- src/Model/Model_ResultBody.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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(); } -- 2.39.2