Skip to content

Commit

Permalink
Memory info: Improve range check
Browse files Browse the repository at this point in the history
Just in case...
  • Loading branch information
Argent77 committed Sep 11, 2024
1 parent 5d6c4ce commit b633060
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/org/infinity/gui/StatusBar.java
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,8 @@ private void updateMemoryProgress() {

// used memory
final long usedMemory = rt.totalMemory() - rt.freeMemory();
memoryProgress.setValue(logScaled.apply(usedMemory));
final int value = Math.min(Math.max(logScaled.apply(usedMemory), 0), memoryProgress.getMaximum());
memoryProgress.setValue(value);

final long usedMemoryMB = usedMemory / (1024L * 1024L);
if (usedMemoryMB >= 1024L) {
Expand Down

0 comments on commit b633060

Please sign in to comment.