From 63ce4fe0bd893d46cffb09e322273d7e89208b40 Mon Sep 17 00:00:00 2001 From: Leijurv Date: Tue, 16 Oct 2018 11:32:27 -0700 Subject: [PATCH] don't crash on empty region --- src/main/java/baritone/cache/CachedWorld.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/main/java/baritone/cache/CachedWorld.java b/src/main/java/baritone/cache/CachedWorld.java index 60126fca..14b66839 100644 --- a/src/main/java/baritone/cache/CachedWorld.java +++ b/src/main/java/baritone/cache/CachedWorld.java @@ -167,6 +167,9 @@ public final class CachedWorld implements ICachedWorld, Helper { private synchronized void prune() { BlockPos pruneCenter = guessPosition(); for (CachedRegion region : allRegions()) { + if (region == null) { + continue; + } int distX = (region.getX() * 512 + 256) - pruneCenter.getX(); int distZ = (region.getZ() * 512 + 256) - pruneCenter.getZ(); double dist = Math.sqrt(distX * distX + distZ * distZ); @@ -187,6 +190,9 @@ public final class CachedWorld implements ICachedWorld, Helper { } CachedChunk mostRecentlyModified = null; for (CachedRegion region : allRegions()) { + if (region == null) { + continue; + } CachedChunk ch = region.mostRecentlyModified(); if (ch == null) { continue;