Fix IOOB Exception

This commit is contained in:
Daniel Mills 2020-12-13 09:38:10 -05:00
parent 73360bb66c
commit e73534ba2f

View File

@ -66,15 +66,19 @@ public abstract class PaletteHunkIOAdapter<T> implements HunkIOAdapter<T> {
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);
}
if(v != null)
{
t.setRaw(x,y,z, v);
}
}
in.close();
return t;