#2392 don't crash on missing NBT data

This commit is contained in:
Matthias Mann committed 2015-04-29 07:41:15 +02:00
1 parent 2c35b44baa
commit d94ee82ac6
1 file changed
+7 -5
@@ -1064,11 +1064,13 @@ public class TileCapacitorBank extends TileEntityEio implements IInternalPowerHa
}
NBTTagList itemList = (NBTTagList) nbtRoot.getTag("Items");
for (int i = 0; i < itemList.tagCount(); i++) {
NBTTagCompound itemStack = itemList.getCompoundTagAt(i);
byte slot = itemStack.getByte("Slot");
if(slot >= 0 && slot < inventory.length) {
inventory[slot] = ItemStack.loadItemStackFromNBT(itemStack);
if(itemList != null) {
for (int i = 0; i < itemList.tagCount(); i++) {
NBTTagCompound itemStack = itemList.getCompoundTagAt(i);
byte slot = itemStack.getByte("Slot");
if(slot >= 0 && slot < inventory.length) {
inventory[slot] = ItemStack.loadItemStackFromNBT(itemStack);
}
}
}