diff --git a/src/ProfileManager.cpp b/src/ProfileManager.cpp index 99fa834e23..f46eb8ee2e 100644 --- a/src/ProfileManager.cpp +++ b/src/ProfileManager.cpp @@ -428,8 +428,10 @@ bool ProfileManager::CreateLocalProfile( RString sName, RString &sProfileIDOut ) int iMaxProfileNumber = -1; vector vs; GetLocalProfileIDs( vs ); - for (RString const &s : vs) - iMaxProfileNumber = std::stoi( s ); + if (vs.size() > 0) + { + iMaxProfileNumber = std::stoi(vs.back()); + } int iProfileNumber = iMaxProfileNumber + 1; RString sProfileID = ssprintf( "%08d", iProfileNumber );