File tree Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Original file line number Diff line number Diff line change @@ -85,15 +85,17 @@ void ProfileLoader::loadProfiles( const std::string& avProfilesPath )
85
85
86
86
void ProfileLoader::update ( const Profile& profile )
87
87
{
88
- std::string profileId ( profile.find ( constants::avProfileIdentificator )->second );
88
+ Profile::const_iterator profileIt = profile.find ( constants::avProfileIdentificator );
89
+ if ( profileIt == profile.end () )
90
+ throw std::runtime_error ( " Invalid profile: can't get identificator" );
91
+
92
+ std::string profileId ( profileIt->second );
89
93
size_t profileIndex = 0 ;
90
94
for ( Profiles::iterator it = _profiles.begin (); it != _profiles.end (); ++it )
91
95
{
96
+ // profile already exists
92
97
if ( (*it).find ( constants::avProfileIdentificator )->second == profileId )
93
- {
94
- _profiles.at ( profileIndex ) = profile;
95
98
return ;
96
- }
97
99
++profileIndex;
98
100
}
99
101
// profile not found: add the new profile
You can’t perform that action at this time.
0 commit comments