From 38a7c771bee6d2aef959e80535c9c67e7272a45d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexander=20S=C3=B6derberg?= Date: Thu, 21 May 2020 20:23:36 +0200 Subject: [PATCH] Don't access tree until it has been created --- .../com/plotsquared/core/plot/world/ScatteredPlotWorld.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Core/src/main/java/com/plotsquared/core/plot/world/ScatteredPlotWorld.java b/Core/src/main/java/com/plotsquared/core/plot/world/ScatteredPlotWorld.java index 78cb0b7b2..9f245a5ba 100644 --- a/Core/src/main/java/com/plotsquared/core/plot/world/ScatteredPlotWorld.java +++ b/Core/src/main/java/com/plotsquared/core/plot/world/ScatteredPlotWorld.java @@ -62,6 +62,9 @@ public class ScatteredPlotWorld extends PlotWorld { } @Override @Nullable public PlotArea getArea(@NotNull final Location location) { + if (this.areas.isEmpty()) { + return null; + } synchronized (this.treeLock) { final Observable> area = areaTree.search(Geometries.point(location.getX(), location.getZ())); @@ -87,6 +90,9 @@ public class ScatteredPlotWorld extends PlotWorld { } @Override @NotNull public Collection getAreasInRegion(@NotNull final CuboidRegion region) { + if (this.areas.isEmpty()) { + return Collections.emptyList(); + } synchronized (this.treeLock) { final List areas = new LinkedList<>(); this.areaTree.search(RegionUtil.toRectangle(region)).toBlocking().forEach(entry -> areas.add(entry.value()));