From e73534ba2fa16e2f89f56c7a1b2e2ed49c13ae30 Mon Sep 17 00:00:00 2001 From: Daniel Mills Date: Sun, 13 Dec 2020 09:38:10 -0500 Subject: [PATCH] Fix IOOB Exception --- .../iris/scaffold/hunk/io/PaletteHunkIOAdapter.java | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/volmit/iris/scaffold/hunk/io/PaletteHunkIOAdapter.java b/src/main/java/com/volmit/iris/scaffold/hunk/io/PaletteHunkIOAdapter.java index 2e28cab8b..78dbe0c91 100644 --- a/src/main/java/com/volmit/iris/scaffold/hunk/io/PaletteHunkIOAdapter.java +++ b/src/main/java/com/volmit/iris/scaffold/hunk/io/PaletteHunkIOAdapter.java @@ -66,14 +66,18 @@ public abstract class PaletteHunkIOAdapter implements HunkIOAdapter { int x = din.readShort() - Short.MIN_VALUE; int y = din.readShort() - Short.MIN_VALUE; int z = din.readShort() - Short.MIN_VALUE; - T v = palette.getPalette().get(din.readShort() - Short.MIN_VALUE); + int vf = din.readShort() - Short.MIN_VALUE; - if(v == null) + T v = null; + if( palette.getPalette().hasIndex(vf)) { - throw new IOException("NULL VALUE AT " + x + " " + y + " " + z); + v = palette.getPalette().get(vf); } - t.setRaw(x,y,z, v); + if(v != null) + { + t.setRaw(x,y,z, v); + } } in.close();