Detect, remove and warn about null tile entities. This prevents odd server crashes, caused by unknown reasons.

This commit is contained in:
md_5 2013-02-03 09:21:35 +11:00
parent 7d858839a7
commit 841693a0c0

View file

@ -0,0 +1,30 @@
From 06871b0489590cbdd3dd4f9cdd9f02d5397c3e6e Mon Sep 17 00:00:00 2001
From: md_5 <md_5@live.com.au>
Date: Sun, 3 Feb 2013 09:20:19 +1100
Subject: [PATCH] Detect, remove and warn about null tile entities.
---
src/main/java/net/minecraft/server/World.java | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index 262290f..cd7ad64 100644
--- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java
@@ -1302,6 +1302,13 @@ public abstract class World implements IBlockAccess {
while (iterator.hasNext()) {
TileEntity tileentity = (TileEntity) iterator.next();
+ // Spigot start
+ if (tileentity == null) {
+ getServer().getLogger().severe("Spigot has detected a null entity and has removed it, preventing a crash");
+ iterator.remove();
+ continue;
+ }
+ // Spigot end
// CraftBukkit start - don't tick entities in chunks queued for unload
ChunkProviderServer chunkProviderServer = ((WorldServer) this).chunkProviderServer;
if (chunkProviderServer.unloadQueue.contains(tileentity.x >> 4, tileentity.z >> 4)) {
--
1.8.1-rc2