1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-06 09:09:40 +02:00

Allow heroes to start with empty armies if configured properly

This commit is contained in:
Dydzio
2023-02-05 00:36:51 +01:00
parent 3f79a9806c
commit 7095e9d8f9
3 changed files with 11 additions and 5 deletions

View File

@@ -182,7 +182,7 @@ std::vector<SlotInfo> ArmyManager::getBestArmy(const IBonusBearer * armyCarrier,
{
auto weakest = getWeakestCreature(resultingArmy);
if(weakest->count == 1)
if(weakest != resultingArmy.end() && weakest->count == 1) //we check iterator validity for playing with settings that allow 0 stacks armies
{
resultingArmy.erase(weakest);
}