From 85eccb571b8f7e55d04acbd8b7636e244e2569d7 Mon Sep 17 00:00:00 2001 From: Shane Freeder Date: Sat, 17 Oct 2020 12:20:44 +0100 Subject: [PATCH] Don't assume that entries exist for SafeNBTCopy --- .../0488-Fix-Non-Full-Status-Chunk-NBT-Memory-Leak.patch | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/Spigot-Server-Patches/0488-Fix-Non-Full-Status-Chunk-NBT-Memory-Leak.patch b/Spigot-Server-Patches/0488-Fix-Non-Full-Status-Chunk-NBT-Memory-Leak.patch index 129aa8941..386c40b37 100644 --- a/Spigot-Server-Patches/0488-Fix-Non-Full-Status-Chunk-NBT-Memory-Leak.patch +++ b/Spigot-Server-Patches/0488-Fix-Non-Full-Status-Chunk-NBT-Memory-Leak.patch @@ -16,7 +16,7 @@ We further improve it by making a copy of the nbt tag with only the memory it needs, so that we dont have to hold a copy to the entire compound. diff --git a/src/main/java/net/minecraft/server/ChunkRegionLoader.java b/src/main/java/net/minecraft/server/ChunkRegionLoader.java -index f18cb4aedc4a6536bf45db591b6d2b64cefce676..fd75bca8d42b2b70e6fe71d6e1b8402eb56e507a 100644 +index f18cb4aedc4a6536bf45db591b6d2b64cefce676..c27078630bffe1b2493b42c9ae4431fb1cc5ca09 100644 --- a/src/main/java/net/minecraft/server/ChunkRegionLoader.java +++ b/src/main/java/net/minecraft/server/ChunkRegionLoader.java @@ -156,15 +156,9 @@ public class ChunkRegionLoader { @@ -38,7 +38,7 @@ index f18cb4aedc4a6536bf45db591b6d2b64cefce676..fd75bca8d42b2b70e6fe71d6e1b8402e } else { ProtoChunk protochunk = new ProtoChunk(chunkcoordintpair, chunkconverter, achunksection, protochunkticklist, protochunkticklist1, worldserver); // Paper - Anti-Xray - Add parameter -@@ -270,6 +264,45 @@ public class ChunkRegionLoader { +@@ -270,6 +264,48 @@ public class ChunkRegionLoader { return new InProgressChunkHolder(protochunk1, tasksToExecuteOnMain); // Paper - Async chunk loading } } @@ -52,7 +52,10 @@ index f18cb4aedc4a6536bf45db591b6d2b64cefce676..fd75bca8d42b2b70e6fe71d6e1b8402e + public SafeNBTCopy(NBTTagCompound base, String... keys) { + for (String key : keys) { + this.keys.add(key); -+ this.set(key, base.get(key)); ++ final NBTBase nbtBase = base.get(key); ++ if (nbtBase != null) { ++ this.set(key, nbtBase); ++ } + } + } +