From 4bc60510f818d300c167c3db36bbdb888d2c11c3 Mon Sep 17 00:00:00 2001
From: Brandon Wright <bearoso@gmail.com>
Date: Fri, 7 Jan 2011 07:05:37 -0600
Subject: [PATCH] (gocha) Fix assertion fault on VS2008 debug build

---
 conffile.cpp | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/conffile.cpp b/conffile.cpp
index daa38551..049b320c 100644
--- a/conffile.cpp
+++ b/conffile.cpp
@@ -461,18 +461,20 @@ 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);
         ret=true;
     }
-	if((i==data.end() && (!alphaSort || timeSort)) || (!alphaSort && timeSort))
+	if((found && (!alphaSort || timeSort)) || (!alphaSort && timeSort))
 		e.line = linectr++;
 
     data.insert(e);