Skip to content

Commit 61eb129

Browse files
tastybentoCopilot
andauthored
Potential fix for pull request finding
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
1 parent 45911db commit 61eb129

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

src/main/java/world/bentobox/bank/BankManager.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -346,9 +346,11 @@ public AccountHistory getLatestHistory(Island island) {
346346
Map<Long, String> history = account.getHistory();
347347
if (history.isEmpty()) return null;
348348

349-
Long latestKey = Collections.max(history.keySet());
350-
String value = history.get(latestKey);
351-
if (value == null) return null;
349+
java.util.Map.Entry<Long, String> latest = ((java.util.NavigableMap<Long, String>) history).lastEntry();
350+
if (latest == null || latest.getValue() == null) return null;
351+
352+
Long latestKey = latest.getKey();
353+
String value = latest.getValue();
352354

353355
String[] split = value.split(":", 3);
354356
if (split.length != 3) return null;

0 commit comments

Comments
 (0)