Skip to content

Commit 293e95a

Browse files
committed
[InfoHud] Fix NPE when joining a world
1 parent 9979e82 commit 293e95a

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/main/java/com/minecrafttas/tasmod/gui/InfoHud.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,9 @@ public boolean checkInit() {
316316
+ "_visible")), Boolean.parseBoolean(configuration.getProperty(title + "_rect")), () -> {
317317
if (Minecraft.getMinecraft().currentScreen == this)
318318
return "Facing";
319-
return String.format("%.2f %.2f", MathHelper.wrapDegrees(TASmodClient.virtual.CAMERA_ANGLE.getCurrentYaw()), MathHelper.wrapDegrees(TASmodClient.virtual.CAMERA_ANGLE.getCurrentPitch()));
319+
if (TASmodClient.virtual.CAMERA_ANGLE.getCurrentYaw() != null)
320+
return String.format("%.2f %.2f", MathHelper.wrapDegrees(TASmodClient.virtual.CAMERA_ANGLE.getCurrentYaw()), MathHelper.wrapDegrees(TASmodClient.virtual.CAMERA_ANGLE.getCurrentPitch()));
321+
return "null";
320322
}));
321323

322324
title = "camera";
@@ -327,7 +329,9 @@ public boolean checkInit() {
327329
+ "_visible")), Boolean.parseBoolean(configuration.getProperty(title + "_rect")), () -> {
328330
if (Minecraft.getMinecraft().currentScreen == this)
329331
return "Camera";
330-
return String.format("%.2f %.2f", MathHelper.wrapDegrees(TASmodClient.virtual.CAMERA_ANGLE.getNextYaw()), MathHelper.wrapDegrees(TASmodClient.virtual.CAMERA_ANGLE.getNextPitch()));
332+
if (TASmodClient.virtual.CAMERA_ANGLE.getNextYaw() != null)
333+
return String.format("%.2f %.2f", MathHelper.wrapDegrees(TASmodClient.virtual.CAMERA_ANGLE.getNextYaw()), MathHelper.wrapDegrees(TASmodClient.virtual.CAMERA_ANGLE.getNextPitch()));
334+
return "null";
331335
}));
332336

333337
title = "cticks";

0 commit comments

Comments
 (0)