1
0
mirror of https://github.com/SquidDev-CC/CC-Tweaked synced 2025-01-12 18:30:29 +00:00

Add some sanity checks to Palette.readFromNBT

Printers use a Terminal to store the page currently being printed.
Printers saved in an older version of ComputerCraft would be missing the
term_palette field, resulting in an NPE when loading the tile.
This commit is contained in:
SquidDev 2017-05-19 11:47:27 +01:00
parent f3c291cb4d
commit 971c719a9f

View File

@ -89,8 +89,11 @@ public class Palette
public void readFromNBT( NBTTagCompound nbt )
{
if( !nbt.hasKey( "term_palette" ) ) return;
int[] rgb8 = nbt.getIntArray( "term_palette" );
if( rgb8.length != colours.length ) return;
for(int i = 0; i < colours.length; ++i)
{
colours[i] = decodeRGB8( rgb8[i] );