mirror of
https://github.com/vcmi/vcmi.git
synced 2024-12-24 22:14:36 +02:00
Fix possible access to non-existing building
This commit is contained in:
parent
67b7c39761
commit
942f8bbf05
@ -996,6 +996,12 @@ CBuilding::TRequired CGTownInstance::genBuildingRequirements(const BuildingID &
|
||||
std::function<CBuilding::TRequired::Variant(const BuildingID &)> dependTest =
|
||||
[&](const BuildingID & id) -> CBuilding::TRequired::Variant
|
||||
{
|
||||
if (town->buildings.count(id) == 0)
|
||||
{
|
||||
logMod->error("Invalid building ID %d in building dependencies!", id.getNum());
|
||||
return CBuilding::TRequired::OperatorAll();
|
||||
}
|
||||
|
||||
const CBuilding * build = town->buildings.at(id);
|
||||
CBuilding::TRequired::OperatorAll requirements;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user