Skip to content
This repository has been archived by the owner on Aug 28, 2018. It is now read-only.

Commit

Permalink
null check for stack creation.
Browse files Browse the repository at this point in the history
  • Loading branch information
CrafterKina committed Jan 18, 2017
1 parent fbfd41c commit 3407faa
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/main/java/jp/crafterkina/pipes/common/item/ItemPipe.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import jp.crafterkina.pipes.common.RegistryEntries;
import jp.crafterkina.pipes.common.pipe.EnumPipeMaterial;
import lombok.extern.log4j.Log4j2;
import net.minecraft.item.EnumDyeColor;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemDye;
Expand All @@ -11,6 +12,7 @@
/**
* Created by Kina on 2016/12/14.
*/
@Log4j2
public class ItemPipe extends ItemBlock{
public ItemPipe(){
super(RegistryEntries.BLOCK.pipe);
Expand Down Expand Up @@ -42,6 +44,10 @@ public static ItemStack createPipeStack(ItemStack stack, EnumPipeMaterial materi

public static ItemStack createPipeStack(ItemStack stack, EnumPipeMaterial material, boolean covered, int color){
NBTTagCompound compound = new NBTTagCompound();
if(material == null){
log.warn("Cannot create pipe stack! Instead it returns an empty stack.", new NullPointerException("Material is null"));
return ItemStack.EMPTY;
}
{
stack.setTagCompound(compound);
compound.setString("material", material.name());
Expand Down

0 comments on commit 3407faa

Please sign in to comment.