[Bleeding] Fixed NullPointerException in InventoryView.setCursor() if you tried to empty the cursor by setting it to null. Fixes BUKKIT-1043

By: Celtic Minstrel <celtic.minstrel.ca@some.place>
This commit is contained in:
CraftBukkit/Spigot 2012-03-13 21:46:00 -04:00
parent b350a11bc0
commit 5f0bee3860

View file

@ -68,8 +68,8 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity {
}
public void setItemOnCursor(ItemStack item) {
CraftItemStack stack = new CraftItemStack(item);
getHandle().inventory.setCarried(stack.getHandle());
net.minecraft.server.ItemStack stack = CraftItemStack.createNMSItemStack(item);
getHandle().inventory.setCarried(stack);
if (this instanceof CraftPlayer) {
((EntityPlayer) getHandle()).broadcastCarriedItem(); // Send set slot for cursor
}