mirror of
https://github.com/wesnoth/wesnoth
synced 2025-05-19 08:55:21 +00:00
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
This commit is contained in:
parent
3420f3dfbc
commit
cb5bc1f022
@ -2279,11 +2279,14 @@ size_t move_unit(move_unit_spectator *move_spectator,
|
||||
}
|
||||
|
||||
//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();
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user