From fc2b198ce206b9b5f26c395327187d84886fdcd9 Mon Sep 17 00:00:00 2001 From: Jason Felds Date: Sat, 4 May 2013 12:03:00 -0400 Subject: [PATCH] Optimization: no need to loop the whole vector. Gotta love the back call. --- src/ProfileManager.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) 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 );