Fixed two segfaults at level advance. (Fix for bug #14098.)
This commit is contained in:
parent
5a3009b671
commit
cad1b70661
2 changed files with 4 additions and 2 deletions
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Add table
Reference in a new issue