Forbade insertion of units with invalid location. (Fix for bug #13174.)
This commit is contained in:
parent
2f2a238fae
commit
507cdef31d
1 changed files with 8 additions and 0 deletions
|
@ -476,6 +476,14 @@ void unit_map::insert(std::pair<map_location,unit> *p)
|
|||
size_t unit_id = p->second.underlying_id();
|
||||
umap::iterator iter = map_.find(unit_id);
|
||||
|
||||
// TODO: should also check for out-of-map locations.
|
||||
if (!p->first.valid()) {
|
||||
ERR_NG << "Trying to add " << p->second.name() <<
|
||||
" - " << p->second.id() << " at an invalid location; Discarding.\n";
|
||||
delete p;
|
||||
return;
|
||||
}
|
||||
|
||||
if (iter == map_.end()) {
|
||||
map_[unit_id] = std::make_pair(true, p);
|
||||
} else if(!iter->second.first) {
|
||||
|
|
Loading…
Add table
Reference in a new issue