mail[Wesnoth-commits] r25299 - /trunk/src/server/simple_wml.cpp


Others Months | Index by Date | Thread Index
>>   [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Header


Content

Posted by dave on March 29, 2008 - 18:23:
Author: dave
Date: Sat Mar 29 18:23:19 2008
New Revision: 25299

URL: http://svn.gna.org/viewcvs/wesnoth?rev=25299&view=rev
Log:
die foul wesnothd bug die!!

Modified:
    trunk/src/server/simple_wml.cpp

Modified: trunk/src/server/simple_wml.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/server/simple_wml.cpp?rev=25299&r1=25298&r2=25299&view=diff
==============================================================================
--- trunk/src/server/simple_wml.cpp (original)
+++ trunk/src/server/simple_wml.cpp Sat Mar 29 18:23:19 2008
@@ -372,6 +372,10 @@
 
        debug_delete(list[index]);
        list.erase(list.begin() + index);
+
+       if(list.empty()) {
+               children_.erase(itor);
+       }
 }
 
 void node::remove_child(const char* name, size_t index)
@@ -383,11 +387,8 @@
 {
        for(child_map::iterator i = children_.begin(); i != children_.end(); 
++i) {
                if(i->first == name) {
-                       if(i->second.empty()) {
-                               return NULL;
-                       } else {
-                               return i->second.front();
-                       }
+                       assert(i->second.empty() == false);
+                       return i->second.front();
                }
        }
 
@@ -538,6 +539,7 @@
        }
 
        for(child_map::iterator i = children_.begin(); i != children_.end(); 
++i) {
+               assert(i->second.empty() == false);
                for(child_list::iterator j = i->second.begin(); j != 
i->second.end(); ++j) {
                        *buf++ = '[';
                        memcpy(buf, i->first.begin(), i->first.size());




Related Messages


Powered by MHonArc, Updated Sat Mar 29 19:21:50 2008