Skip to content

Commit

Permalink
Turn a null-dereference into an assertion failure
Browse files Browse the repository at this point in the history
Found by coverity
  • Loading branch information
AI0867 committed Nov 20, 2014
1 parent 12b2e1d commit ae7efb8
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/ai/simulated_actions.cpp
Expand Up @@ -244,6 +244,10 @@ void helper_advance_unit(const map_location& loc){
if(advance_choice < options.size()){
std::string advance_unit_typename = options[advance_choice];
const unit_type *advanced_type = unit_types.find(advance_unit_typename);
if(!advanced_type) {
ERR_AI_SIM_ACTIONS << "Simulating advancing to unknown unit type: " << advance_unit_typename;
assert(false && "simulating to unknown unit type");
}
advanced_unit.set_experience(advanced_unit.experience() - advanced_unit.max_experience());
advanced_unit.advance_to(*advanced_type);
advanced_unit.heal_all();
Expand Down

0 comments on commit ae7efb8

Please sign in to comment.