1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-08-10 22:31:40 +02:00

Merge pull request #5661 from kdmcser/crash_fix2

fix crash when creature level is 0
This commit is contained in:
Ivan Savenko
2025-04-30 13:38:25 +03:00
committed by GitHub

View File

@@ -175,6 +175,7 @@ std::shared_ptr<Bonus> DivideStackLevelUpdater::apply(const std::shared_ptr<Bonu
return b; // e.g. war machines & other special units
auto newBonus = std::make_shared<Bonus>(*b);
level = std::max(1, level);
newBonus->val /= level;
newBonus->updater = nullptr; // prevent double-apply
return newBonus;