summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author alemi <me@alemi.dev>2023-03-15 10:51:40 +0100
committer alemi <me@alemi.dev>2023-03-15 10:51:40 +0100
commit58af56f3171d6b937852fe2fd62294b48b58043b (patch)
tree6325d92999bd0a6485d39a509f389ffb3abc17ea
parent288c6c5d3f00cd47ad315b78361913904f678dff (diff)
fix: bungeecord server switching crash
-rw-r--r--src/main/java/ftbsc/bscv/modules/hud/InfoDisplay.java7
1 files 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;