mirror of
https://github.com/vcmi/vcmi.git
synced 2025-04-25 12:14:46 +02:00
Fix possible crash on abandoned mine with no valid resources
This commit is contained in:
parent
28a3deb42b
commit
4835a1f695
@ -117,7 +117,15 @@ void CGMine::initObj(CRandomGenerator & rand)
|
|||||||
putStack(SlotID(0), troglodytes);
|
putStack(SlotID(0), troglodytes);
|
||||||
|
|
||||||
assert(!abandonedMineResources.empty());
|
assert(!abandonedMineResources.empty());
|
||||||
producedResource = *RandomGeneratorUtil::nextItem(abandonedMineResources, rand);
|
if (!abandonedMineResources.empty())
|
||||||
|
{
|
||||||
|
producedResource = *RandomGeneratorUtil::nextItem(abandonedMineResources, rand);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
logGlobal->error("Abandoned mine at (%s) has no valid resource candidates!", pos.toString());
|
||||||
|
producedResource = GameResID::GOLD;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user