diff --git a/src/main/java/storagecraft/item/ItemBlockStorage.java b/src/main/java/storagecraft/item/ItemBlockStorage.java index df9e21b0a..8aedc6a1f 100644 --- a/src/main/java/storagecraft/item/ItemBlockStorage.java +++ b/src/main/java/storagecraft/item/ItemBlockStorage.java @@ -23,15 +23,18 @@ public class ItemBlockStorage extends ItemBlockBase { EnumStorageType type = EnumStorageType.getById(stack.getMetadata()); - NBTTagCompound tag = stack.getTagCompound().getCompoundTag(TileStorage.NBT_STORAGE); + if (type != null && stack.getTagCompound() != null && stack.getTagCompound().hasKey(TileStorage.NBT_STORAGE)) + { + NBTTagCompound tag = stack.getTagCompound().getCompoundTag(TileStorage.NBT_STORAGE); - if (type == EnumStorageType.TYPE_CREATIVE) - { - list.add(String.format(StatCollector.translateToLocal("misc.storagecraft:storage.stored"), NBTStorage.getStored(tag))); - } - else - { - list.add(String.format(StatCollector.translateToLocal("misc.storagecraft:storage.stored_capacity"), NBTStorage.getStored(tag), type.getCapacity())); + if (type == EnumStorageType.TYPE_CREATIVE) + { + list.add(String.format(StatCollector.translateToLocal("misc.storagecraft:storage.stored"), NBTStorage.getStored(tag))); + } + else + { + list.add(String.format(StatCollector.translateToLocal("misc.storagecraft:storage.stored_capacity"), NBTStorage.getStored(tag), type.getCapacity())); + } } }