Don't try to read the data outside of the try-catch

This commit is contained in:
Shane Freeder 2019-04-15 05:06:43 +01:00
parent 1a74c62cf3
commit 9cc93b1229

View file

@ -15,16 +15,17 @@ Should Mojang choose to alter this behavior in the future, this change
will simply defer to whatever that new behavior is.
diff --git a/src/main/java/net/minecraft/server/RegionFileCache.java b/src/main/java/net/minecraft/server/RegionFileCache.java
index 17e76815ad..2eb7888027 100644
index 17e76815ad..369aaa84c4 100644
--- a/src/main/java/net/minecraft/server/RegionFileCache.java
+++ b/src/main/java/net/minecraft/server/RegionFileCache.java
@@ -0,0 +0,0 @@ public class RegionFileCache {
private static NBTTagCompound readOversizedChunk(RegionFile regionfile, int i, int j) throws IOException {
synchronized (regionfile) {
try (DataInputStream datainputstream = regionfile.getReadStream(i & 31, j & 31)) {
+ // Paper start - Handle bad chunks more gracefully - also handle similarly with oversized data
NBTTagCompound oversizedData = regionfile.getOversizedData(i, j);
- NBTTagCompound oversizedData = regionfile.getOversizedData(i, j);
- NBTTagCompound chunk = NBTCompressedStreamTools.readNBT(datainputstream);
+ // Paper start - Handle bad chunks more gracefully - also handle similarly with oversized data
+ NBTTagCompound oversizedData = null;
+
+ try {
+ oversizedData = regionfile.getOversizedData(i, j);