From 58af56f3171d6b937852fe2fd62294b48b58043b Mon Sep 17 00:00:00 2001 From: alemi Date: Wed, 15 Mar 2023 10:51:40 +0100 Subject: fix: bungeecord server switching crash --- src/main/java/ftbsc/bscv/modules/hud/InfoDisplay.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/main/java/ftbsc/bscv/modules/hud/InfoDisplay.java b/src/main/java/ftbsc/bscv/modules/hud/InfoDisplay.java index df48b3f..2df6b10 100644 --- a/src/main/java/ftbsc/bscv/modules/hud/InfoDisplay.java +++ b/src/main/java/ftbsc/bscv/modules/hud/InfoDisplay.java @@ -127,9 +127,12 @@ public class InfoDisplay extends HudModule { if (MC.player != null) { this.instant_speed = this.last_position.distanceTo(MC.player.position()); this.last_position = MC.player.position(); - this.instant_ping = MC.getConnection().getPlayerInfo( + NetworkPlayerInfo info = MC.getConnection().getPlayerInfo( MC.player.getGameProfile().getId() - ).getLatency(); + ); + if (info != null) { // bungeecord switching makes this null for a second + this.instant_ping = info.getLatency(); + } } else { this.instant_speed = 0.0; this.instant_ping = 0; -- cgit v1.2.3-56-ga3b1