Add missing null check for structure start chunk access

Spigot made structure start not load chunks, but forgot to null check
the result...

This likely never blew up before due to the chunk leak issue, but now
that leaky chunks are cleaned up, it was identified.
This commit is contained in:
Aikar 2020-05-25 14:19:11 -04:00
parent db9534bfdf
commit 1b23cf5819

View file

@ -21,6 +21,14 @@ diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/m
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/ChunkProviderServer.java
+++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java
@@ -0,0 +0,0 @@ public class ChunkProviderServer extends IChunkProvider {
}
}
// Paper start
+ if (playerchunk != null) playerchunk.lastActivity = world.getTime(); // Paper
CompletableFuture<Either<IChunkAccess, PlayerChunk.Failure>> future = this.a(playerchunk, l) ? PlayerChunk.UNLOADED_CHUNK_ACCESS_FUTURE : playerchunk.a(chunkstatus, this.playerChunkMap);
if (isUrgent) {
future.thenAccept(either -> this.chunkMapDistance.clearUrgent(chunkcoordintpair));
@@ -0,0 +0,0 @@ public class ChunkProviderServer extends IChunkProvider {
if (chunksTicked[0]++ % 10 == 0) this.world.getMinecraftServer().midTickLoadChunks(); // Paper
}
@ -104,3 +112,16 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
PlayerChunk playerchunk = (PlayerChunk) this.updatingChunks.remove(j);
if (playerchunk != null) {
diff --git a/src/main/java/net/minecraft/server/StructureGenerator.java b/src/main/java/net/minecraft/server/StructureGenerator.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/StructureGenerator.java
+++ b/src/main/java/net/minecraft/server/StructureGenerator.java
@@ -0,0 +0,0 @@ public abstract class StructureGenerator<C extends WorldGenFeatureConfiguration>
while (longiterator.hasNext()) {
long k = longiterator.nextLong();
IChunkAccess ichunkaccess1 = generatoraccess.getChunkAt(ChunkCoordIntPair.getX(k), ChunkCoordIntPair.getZ(k), ChunkStatus.STRUCTURE_STARTS, false); // CraftBukkit - don't load chunks
- StructureStart structurestart = ichunkaccess1.a(this.b());
+ StructureStart structurestart = ichunkaccess1 != null ? ichunkaccess1.a(this.b()) : null; // Paper - make sure not null
if (structurestart != null) {
list.add(structurestart);