Browse Source

fix crash when creature level is 0

kdmcser 5 months ago
parent
commit
9310ff3b7a
1 changed files with 1 additions and 0 deletions
  1. 1 0
      lib/bonuses/Updaters.cpp

+ 1 - 0
lib/bonuses/Updaters.cpp

@@ -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;