From 4b7e27b41be7adf9f2bb1f83395c97f60f103d4a Mon Sep 17 00:00:00 2001 From: Dreeam <61569423+Dreeam-qwq@users.noreply.github.com> Date: Tue, 27 Feb 2024 06:35:31 -0500 Subject: [PATCH] Fix NPE during creating GUI graph (#191) --- ...35-Fix-NPE-during-creating-GUI-graph.patch | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 patches/server/0135-Fix-NPE-during-creating-GUI-graph.patch diff --git a/patches/server/0135-Fix-NPE-during-creating-GUI-graph.patch b/patches/server/0135-Fix-NPE-during-creating-GUI-graph.patch new file mode 100644 index 00000000..6efaca90 --- /dev/null +++ b/patches/server/0135-Fix-NPE-during-creating-GUI-graph.patch @@ -0,0 +1,25 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Dreeam <61569423+Dreeam-qwq@users.noreply.github.com> +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 { + GraphData data = RAMGraph.DATA.peekLast(); + Vector 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++) {