Skip to content

Commit

Permalink
Fix ability to int overflow when adding to LP network (GTNewHorizons#64)
Browse files Browse the repository at this point in the history
  • Loading branch information
Ruling-0 authored and DrParadox7 committed Jan 26, 2025
1 parent 3711856 commit 42ca4c6
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ public static int addCurrentEssenceToMaximum(String ownerName, int addedEssence,
return 0;
}

int newEss = Math.min(event.maximum, currEss + event.addedAmount);
int newEss = (int) Math.min(Integer.MAX_VALUE, Math.min(event.maximum, (long) currEss + event.addedAmount));
if (event.getResult() != Event.Result.DENY) {
data.currentEssence = newEss;
}
Expand Down

0 comments on commit 42ca4c6

Please sign in to comment.