(gocha) Fix assertion fault on VS2008 debug build

This commit is contained in:
Brandon Wright 2011-01-07 07:05:37 -06:00
parent a5fd29f4d0
commit 8b6dd06977
1 changed files with 4 additions and 2 deletions

View File

@ -459,19 +459,21 @@ char *ConfigFile::GetStringDup(const char *key, const char *def){
bool ConfigFile::SetString(const char *key, string val, const char *comment){
set<ConfigEntry, ConfigEntry::key_less>::iterator i;
bool ret=false;
bool found;
ConfigEntry e(key, val);
if(comment && *comment) e.comment = comment;
e.used=true;
i=data.find(e);
if(i!=data.end()){
found=(i==data.end());
if(!found){
e.line=i->line;
data.erase(e);
sectionSizes.DecreaseSectionSize(e.section);
ret=true;
}
if((i==data.end() && (!alphaSort || timeSort)) || (!alphaSort && timeSort))
if((found && (!alphaSort || timeSort)) || (!alphaSort && timeSort))
e.line = linectr++;
data.insert(e);