Skip to content

Commit

Permalink
Fix NPE during creating GUI graph (LeavesMC#191)
Browse files Browse the repository at this point in the history
  • Loading branch information
Dreeam-qwq authored and Lumine1909 committed May 5, 2024
1 parent 46808bf commit 4b7e27b
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions patches/server/0135-Fix-NPE-during-creating-GUI-graph.patch
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++) {

0 comments on commit 4b7e27b

Please sign in to comment.