forked from LeavesMC/Leaves
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix NPE during creating GUI graph (LeavesMC#191)
- Loading branch information
1 parent
46808bf
commit 4b7e27b
Showing
1 changed file
with
25 additions
and
0 deletions.
There are no files selected for viewing
25 changes: 25 additions & 0 deletions
25
patches/server/0135-Fix-NPE-during-creating-GUI-graph.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 | ||
From: Dreeam <[email protected]> | ||
Date: Tue, 27 Feb 2024 03:27:48 -0500 | ||
Subject: [PATCH] Fix NPE during creating GUI graph | ||
|
||
|
||
diff --git a/src/main/java/com/destroystokyo/paper/gui/RAMDetails.java b/src/main/java/com/destroystokyo/paper/gui/RAMDetails.java | ||
index 039a86034928a5eb7aaa2d7ca76a7bddcca346bd..7bf45a85d51ea0e2c6dfa1c5f2f07f99dab0bca6 100644 | ||
--- a/src/main/java/com/destroystokyo/paper/gui/RAMDetails.java | ||
+++ b/src/main/java/com/destroystokyo/paper/gui/RAMDetails.java | ||
@@ -59,7 +59,13 @@ public class RAMDetails extends JList<String> { | ||
GraphData data = RAMGraph.DATA.peekLast(); | ||
Vector<String> vector = new Vector<>(); | ||
|
||
- double[] tps = org.bukkit.Bukkit.getTPS(); | ||
+ // Leaves start - Fix potential NPE during creating GUI graph | ||
+ double[] tps = new double[]{ | ||
+ server.tps1.getAverage(), | ||
+ server.tps5.getAverage(), | ||
+ server.tps15.getAverage() | ||
+ }; | ||
+ // Leaves end | ||
String[] tpsAvg = new String[tps.length]; | ||
|
||
for ( int g = 0; g < tps.length; g++) { |