aboutsummaryrefslogtreecommitdiff
path: root/spark-bukkit/src/main
diff options
context:
space:
mode:
authorvaperion <vaperion@riseup.net>2022-12-31 15:37:47 +0100
committerlucko <git@lucko.me>2022-12-31 18:31:07 +0000
commit690d09f58d125fcde22a031335d0a1d6af37b954 (patch)
tree8220898205eae2cf4e39dd83ee34ead78310a0a7 /spark-bukkit/src/main
parentd9655c40c02aef137c7a6a00a1cc90a1e6fb08d1 (diff)
downloadspark-690d09f58d125fcde22a031335d0a1d6af37b954.tar.gz
spark-690d09f58d125fcde22a031335d0a1d6af37b954.tar.bz2
spark-690d09f58d125fcde22a031335d0a1d6af37b954.zip
Fix NPE in profiler when Chunk#getTileEntities returns null
Diffstat (limited to 'spark-bukkit/src/main')
-rw-r--r--spark-bukkit/src/main/java/me/lucko/spark/bukkit/BukkitWorldInfoProvider.java4
1 files changed, 3 insertions, 1 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 8f876cf..8a4c0e4 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
@@ -27,6 +27,7 @@ import me.lucko.spark.common.platform.world.WorldInfoProvider;
import org.bukkit.Chunk;
import org.bukkit.Server;
import org.bukkit.World;
+import org.bukkit.block.BlockState;
import org.bukkit.entity.Entity;
import org.bukkit.entity.EntityType;
@@ -71,7 +72,8 @@ public class BukkitWorldInfoProvider implements WorldInfoProvider {
entities += world.getEntities().size();
Chunk[] chunksArray = world.getLoadedChunks();
for (Chunk chunk : chunksArray) {
- tileEntities += chunk.getTileEntities().length;
+ BlockState[] tileEntitiesArray = chunk.getTileEntities();
+ tileEntities += tileEntitiesArray != null ? tileEntitiesArray.length : 0;
}
chunks += chunksArray.length;
}