From 3c6b571697bde94d92962181a5a12d1360df5574 Mon Sep 17 00:00:00 2001 From: Frederik Mikkelsen Date: Fri, 9 Nov 2018 13:39:18 +0100 Subject: [PATCH] Fix attempt to use non-finite number in stats --- .../src/main/java/lavalink/server/io/StatsTask.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/LavalinkServer/src/main/java/lavalink/server/io/StatsTask.java b/LavalinkServer/src/main/java/lavalink/server/io/StatsTask.java index a9237893f..cdb9c7f87 100644 --- a/LavalinkServer/src/main/java/lavalink/server/io/StatsTask.java +++ b/LavalinkServer/src/main/java/lavalink/server/io/StatsTask.java @@ -90,7 +90,9 @@ private void sendStats() { JSONObject cpu = new JSONObject(); cpu.put("cores", Runtime.getRuntime().availableProcessors()); cpu.put("systemLoad", hal.getProcessor().getSystemCpuLoad()); - cpu.put("lavalinkLoad", getProcessRecentCpuUsage()); + double load = getProcessRecentCpuUsage(); + if (!Double.isFinite(load)) load = 0; + cpu.put("lavalinkLoad", load); out.put("cpu", cpu);