From d5466e0fdac46efa4784bb2704c1ad95020da773 Mon Sep 17 00:00:00 2001 From: James Seibel Date: Fri, 22 Oct 2021 20:46:26 -0500 Subject: [PATCH] Fix a potential null pointer exception when leaving the world The thread dealing with these should probably be killed and recreated when leaving the world instead of just catching the problem here. --- .../java/com/seibel/lod/builders/lodBuilding/LodBuilder.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/main/java/com/seibel/lod/builders/lodBuilding/LodBuilder.java b/src/main/java/com/seibel/lod/builders/lodBuilding/LodBuilder.java index ff429c69e..9f9baebe3 100644 --- a/src/main/java/com/seibel/lod/builders/lodBuilding/LodBuilder.java +++ b/src/main/java/com/seibel/lod/builders/lodBuilding/LodBuilder.java @@ -155,6 +155,11 @@ public class LodBuilder if (mc.getClientWorld() == null) return; + // don't try to generate LODs if the user isn't in the world anymore + // (this happens a lot when the user leaves a world/server) + if (mc.getSinglePlayerServer() == null && mc.getCurrentServer() == null) + return; + DimensionType dim = world.dimensionType(); // make sure the dimension exists