diff options
author | Luck <git@lucko.me> | 2022-09-04 10:21:23 +0100 |
---|---|---|
committer | Luck <git@lucko.me> | 2022-09-04 10:21:48 +0100 |
commit | 22e29390a12c3b8989355d18ec9e462a19008e3a (patch) | |
tree | 0d38c486c5e53a1064112db98a276667350aef6d /spark-bukkit | |
parent | c96f88f7c125109edcae382b8d10011e87125102 (diff) | |
download | spark-22e29390a12c3b8989355d18ec9e462a19008e3a.tar.gz spark-22e29390a12c3b8989355d18ec9e462a19008e3a.tar.bz2 spark-22e29390a12c3b8989355d18ec9e462a19008e3a.zip |
Add extra null checks to BukkitWorldInfoProvider (#247)
Diffstat (limited to 'spark-bukkit')
-rw-r--r-- | spark-bukkit/src/main/java/me/lucko/spark/bukkit/BukkitWorldInfoProvider.java | 8 |
1 files changed, 6 insertions, 2 deletions
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<BukkitChunkInfo> 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()); + } } } |