Author: alink
Date: Tue Nov 24 01:26:38 2009
New Revision: 39905

URL: http://svn.gna.org/viewcvs/wesnoth?rev=39905&view=rev
Log:
Fix bug #14826 :"Attempt to dereference invalid iterator" assert in TSL 
scenario 2
Prevent the crash but I still need to check waypoints(if used) for these 
special cases

Modified:
    trunk/src/actions.cpp

Modified: trunk/src/actions.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/actions.cpp?rev=39905&r1=39904&r2=39905&view=diff
==============================================================================
--- trunk/src/actions.cpp (original)
+++ trunk/src/actions.cpp Tue Nov 24 01:26:38 2009
@@ -2279,11 +2279,14 @@
        }
 
        //remove used waypoints
-       std::list<map_location>& waypoints = ui->second.waypoints();
-       if(!waypoints.empty()) {
+       //TODO:deal with the other case too
+       if(ui != units.end()) {
+               std::list<map_location>& waypoints = ui->second.waypoints();
                foreach(const map_location& loc, steps) {
-                       if(waypoints.front() == loc)
-                               waypoints.pop_front();
+                               if(waypoints.empty())
+                                       break;
+                               if(waypoints.front() == loc)
+                                       waypoints.pop_front();
                }
        }
 


_______________________________________________
Wesnoth-commits mailing list
[email protected]
https://mail.gna.org/listinfo/wesnoth-commits

Reply via email to