mirror of
https://github.com/vcmi/vcmi.git
synced 2025-01-14 02:33:51 +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 =
|
std::function<CBuilding::TRequired::Variant(const BuildingID &)> dependTest =
|
||||||
[&](const BuildingID & id) -> CBuilding::TRequired::Variant
|
[&](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);
|
const CBuilding * build = town->buildings.at(id);
|
||||||
CBuilding::TRequired::OperatorAll requirements;
|
CBuilding::TRequired::OperatorAll requirements;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user