Fixed two segfaults at level advance. (Fix for bug #14098.)

This commit is contained in:
Guillaume Melquiond 2009-08-10 15:25:10 +00:00
parent 5a3009b671
commit cad1b70661
2 changed files with 4 additions and 2 deletions

View file

@ -1934,7 +1934,8 @@ void advance_unit(map_location loc, const std::string &advance_to)
if(!u.valid()) {
return;
}
std::string const& original_type = u->second.type_id();
// original_type is not a reference, since the unit may disappear at any moment.
std::string original_type = u->second.type_id();
LOG_NG << "firing advance event at " << loc <<"\n";
game_events::fire("advance",loc);

View file

@ -187,7 +187,8 @@ bool animate_unit_advancement(const map_location &loc, size_t choice)
}
if(choice < options.size()) {
const std::string& chosen_unit = options[choice];
// chosen_unit is not a reference, since the unit may disappear at any moment.
std::string chosen_unit = options[choice];
::advance_unit(loc, chosen_unit);
} else {
unit amla_unit(u->second);