1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-12-24 22:14:36 +02:00

Avoid crash on invalid building identifier

This commit is contained in:
Ivan Savenko 2023-12-13 16:55:38 +02:00
parent 664da58d4f
commit 3bd85d417e

View File

@ -77,7 +77,7 @@ void CTownInstanceConstructor::afterLoadFinalization()
{
filters[entry.first] = LogicalExpression<BuildingID>(entry.second, [this](const JsonNode & node)
{
return BuildingID(VLC->identifiers()->getIdentifier("building." + faction->getJsonKey(), node.Vector()[0]).value());
return BuildingID(VLC->identifiers()->getIdentifier("building." + faction->getJsonKey(), node.Vector()[0]).value_or(-1));
});
}
}