Skip to content

Commit 2a3958d

Browse files
committed
Fixed Java Heap Space issue when getProgressBar division zero
1 parent b0308bb commit 2a3958d

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

.github/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
### 1.3.7 Release
22
* Moved FoodLose/HungerLose to core
33
* Fixed LanguageMigrator file version fetching
4+
* Fixed Java Heap Space issue when getProgressBar division zero
45

56
### 1.3.6 Release (13.01.2024)
67
* Fixed IAE Cannot measure distance between worlds if players are in different worlds

MiniGamesBox Utils/src/main/java/plugily/projects/minigamesbox/string/StringFormatUtils.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,9 @@ public static String formatIntoMMSS(int secsIn) {
5454
* @return String with requested progress
5555
*/
5656
public static String getProgressBar(int current, int max, int totalBars, String symbol, String completedCharacter, String notCompletedCharacter) {
57+
if(max == 0) {
58+
max = current;
59+
}
5760
float percent = (float) current / max;
5861
int progressBars = (int) (totalBars * percent);
5962
int leftOver = (totalBars - progressBars);

0 commit comments

Comments
 (0)