From 22e29390a12c3b8989355d18ec9e462a19008e3a Mon Sep 17 00:00:00 2001 From: Luck Date: Sun, 4 Sep 2022 10:21:23 +0100 Subject: Add extra null checks to BukkitWorldInfoProvider (#247) --- .../main/java/me/lucko/spark/bukkit/BukkitWorldInfoProvider.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'spark-bukkit') diff --git a/spark-bukkit/src/main/java/me/lucko/spark/bukkit/BukkitWorldInfoProvider.java b/spark-bukkit/src/main/java/me/lucko/spark/bukkit/BukkitWorldInfoProvider.java index 5d50eeb..79c2715 100644 --- a/spark-bukkit/src/main/java/me/lucko/spark/bukkit/BukkitWorldInfoProvider.java +++ b/spark-bukkit/src/main/java/me/lucko/spark/bukkit/BukkitWorldInfoProvider.java @@ -49,7 +49,9 @@ public class BukkitWorldInfoProvider implements WorldInfoProvider { List list = new ArrayList<>(chunks.length); for (Chunk chunk : chunks) { - list.add(new BukkitChunkInfo(chunk)); + if (chunk != null) { + list.add(new BukkitChunkInfo(chunk)); + } } data.put(world.getName(), list); @@ -66,7 +68,9 @@ public class BukkitWorldInfoProvider implements WorldInfoProvider { this.entityCounts = new CountMap.EnumKeyed<>(EntityType.class); for (Entity entity : chunk.getEntities()) { - this.entityCounts.increment(entity.getType()); + if (entity != null) { + this.entityCounts.increment(entity.getType()); + } } } -- cgit