Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix NPE during creating GUI graph #191

Merged
merged 1 commit into from
Feb 27, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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++) {
Loading