Fix LavaCrystal NPE

When attempting to place an unbound Lava Crystal into a furnace, it would crash when looking for the bound player because... well... it was unbound... :D
This commit is contained in:
Nick 2016-01-01 01:06:56 -08:00
parent 65d75313cb
commit a2e77adbff

View file

@ -1,5 +1,6 @@
package WayofTime.bloodmagic.item; package WayofTime.bloodmagic.item;
import com.google.common.base.Strings;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item; import net.minecraft.item.Item;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
@ -52,10 +53,13 @@ public class ItemLavaCrystal extends ItemBindable implements IFuelHandler
return 200; return 200;
} else } else
{ {
EntityPlayer player = PlayerHelper.getPlayerFromUUID(getBindableOwner(fuel)); if (!Strings.isNullOrEmpty(getBindableOwner(fuel)))
if (player != null)
{ {
player.addPotionEffect(new PotionEffect(Potion.confusion.getId(), 99)); EntityPlayer player = PlayerHelper.getPlayerFromUUID(getBindableOwner(fuel));
if (player != null)
{
player.addPotionEffect(new PotionEffect(Potion.confusion.getId(), 99));
}
} }
return 0; return 0;