This fixes BR#3310 Hangs on end turn uc.probability is zero.

This commit is contained in:
Stian Grenborgen 2023-01-03 19:50:58 +01:00
parent fc293ffcd6
commit 317861fcb8
1 changed files with 2 additions and 1 deletions

View File

@ -999,7 +999,8 @@ public class ServerUnit extends Unit implements TurnTaker {
&& (produce = getWorkType()) != null
&& (learn = spec.getExpertForProducing(produce)) != null
&& learn != getType()
&& (uc = getUnitChange(UnitChangeType.EXPERIENCE,learn)) != null) {
&& (uc = getUnitChange(UnitChangeType.EXPERIENCE,learn)) != null
&& uc.probability > 0) {
int maximumExperience = getType().getMaximumExperience();
int maxValue = (100 * maximumExperience) / uc.probability;
if (maxValue > 0