mirror of
https://github.com/vcmi/vcmi.git
synced 2025-02-03 13:01:33 +02:00
Warn in log instead of crash on invalid building ID from mod
This commit is contained in:
parent
1a4797a6c0
commit
2eeb6510c1
@ -1540,8 +1540,11 @@ CHallInterface::CHallInterface(const CGTownInstance * Town):
|
|||||||
const CBuilding * building = nullptr;
|
const CBuilding * building = nullptr;
|
||||||
for(auto & buildingID : boxList[row][col])//we are looking for the first not built structure
|
for(auto & buildingID : boxList[row][col])//we are looking for the first not built structure
|
||||||
{
|
{
|
||||||
if (town->town->buildings.count(buildingID) == 0)
|
if (!buildingID.hasValue())
|
||||||
throw std::runtime_error("Town " + Town->town->faction->getJsonKey() + " has no building with ID " + std::to_string(buildingID.getNum()));
|
{
|
||||||
|
logMod->warn("Invalid building ID found in hallSlots of town '%s'", town->town->faction->getJsonKey() );
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
const CBuilding * current = town->town->buildings.at(buildingID);
|
const CBuilding * current = town->town->buildings.at(buildingID);
|
||||||
if(vstd::contains(town->builtBuildings, buildingID))
|
if(vstd::contains(town->builtBuildings, buildingID))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user